是否可以使用Power Shell Script获取IIS设置?
我希望使用脚本获取/检查以下信息:
答案 0 :(得分:2)
是的,PowerShell可以轻松实现这一切。网上有很多样本和例子。
查看(IIS) Administration Cmdlets in Windows PowerShell 尤其是Get-WebConfiguration和Get-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
答案 1 :(得分:0)
以下是阅读匿名和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