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'运算符代替。 –