繁体   English   中英

Powershell脚本来验证IIS设置

[英]Powershell script to verify IIS Settings

是否可以使用Power Shell脚本获取IIS设置?

我希望使用脚本获取/检查以下信息:

  1. 检查是否正确列出了Windows身份验证提供程序(协商,NTLM)
  2. 检查是否启用了Windows身份验证
  3. Windows身份验证高级设置->启用内核模式已打开

是的,使用PowerShell可以轻松实现。 在线上有很多示例。

查看Windows PowerShell中的(IIS)管理Cmdlet ,尤其是Get-WebConfigurationGet-WebConfigurationProperty

要获取有关Windows身份验证高级设置的信息,请使用:

$windowsAuthFilter = "/system.WebServer/security/authentication/windowsAuthentication"
$winKernel = (Get-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST' -location 'Default Web Site' -filter "$windowsAuthFilter" -name "useKernelMode").Value
$winKernel 
$winProviders = Get-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST' -location 'Default Web Site' -filter "$windowsAuthFilter/providers" -name "." 
$winProviders.Collection | Format-Table value

以下是阅读匿名和Windows身份验证的答案:

$anonAuthFilter =    "/system.WebServer/security/authentication/AnonymousAuthentication"
$windowsAuthFilter = "/system.WebServer/security/authentication/windowsAuthentication"

$value = 'false'
$AppName = "test"

$anonAuth = Get-WebConfigurationProperty -filter $anonAuthFilter -name Enabled -location $AppName
Write-Host  $anonAuth.Value


$winAuth = Get-WebConfigurationProperty -filter $windowsAuthFilter -name Enabled -location $AppName
Write-Host  $winAuth.Value

@Peter Hahndorf仍然没有找到任何线索

检查Windows身份验证高级设置->启用内核模式已打开,

检查NTLM和Negotiate等已启用的提供程序

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM