1
我試圖找到$ unhotfix數組中聲明的所有修補程序,然後卸載每個如果找到。Powershell匹配數組和管道來處理
$unhotfix ="KB2966826","KB2966827","KB2966828"
Get-Hotfix | ? (HotFixId -match $unhotfix) | `
${wusa.exe /uninstall /kb:$_.HotfixId /norestart /log} | wait-process
使用下面的作品比較一個值:
Get-Hotfix | ? (HotFixId -match "KB2966826") | select HotFixId
不過,我失去了一些東西大約相同排列
Get-Hotfix | ? (HotFixId -match $unhotfixid) | select HotFixId
沒有給出結果。
'Contains()'方法區分大小寫。我建議使用'-contains'運算符代替。 –