所以我想寫一個非常簡單的我認爲每個4。這看起來在一個目錄中,列出了一堆頁面,然後獲取名稱,並將其添加到IIS的錯誤頁面腳本中。它會起作用嗎?!不...我從IIS獲取的錯誤不一致。任何人有這個問題?任何人都看到我在做什麼錯在這裏...PowerShell將錯誤頁面添加到IIS中
目錄列表」
400.htm
401-1.htm
401-2.htm
401-3.htm
401-4.htm
401-5.htm
403-1.htm
403-10.htm
403-11.htm
403-12.htm
403-13.htm
403-14.htm
403-15.htm
403-16.htm
403-17.htm
403-2.htm
403-3.htm
403-4.htm
403-5.htm
403-6.htm
403-7.htm
403-8.htm
403-9.htm
403.htm
404-1.htm
404.htm
405.htm
406.htm
407.htm
410.htm
412.htm
414.htm
500-12.htm
500-13.htm
500-15.htm
500.htm
501.htm
502.htm
htmla.htm
我的代碼如下:?
$files = dir D:\iis\errorpages
Foreach ($file in $files)
{
$file = $file -replace "[^0-9]"
Add-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST/Website' -filter "system.webServer/httpErrors" -name "." -value @{statusCode=$file;prefixLanguageFilePath='D:\iis\errorpages';path="$file"}
}
*「...一個簡單的我認爲4每個」*,這是否意味着它只在'ForEach'循環中失敗,並且'Add-WebConfigurationProperty'獨立工作,插入'$ file '手動變量? – iRon