簡體   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