Get-content -path z:\path\name.txt |
foreach {
(get-hotfix -Computername $_ |
Sort-object IUnstalledon)[-1]
}
我想计算并将计数放在(输出中的get-hotfix)
之前1 computer-name update ncncncncn cncncncncncn date time
2 computer name.....
答案 0 :(得分:2)
也许是这样的?
#Count variable
$i = 0
Get-content -path z:\path\name.txt |
foreach {
$hotfix = (get-hotfix -Computername $_ | Sort-object IUnstalledon)[-1]
#Create your output string "Count ComputerName Hotfix"
Write-Output "$i $_ $hotfix"
$i++
}