Powershell-我如何做到这一点
我想计数并将计数放在前面(在输出中获取修补程序)Powershell-我如何做到这一点,powershell,Powershell,我想计数并将计数放在前面(在输出中获取修补程序) 也许是这样的 1 computer-name update ncncncncn cncncncncncn date time 2 computer name..... 1 computer-name update ncncncncn cncncncncncn date time 2 computer name..... #Count variable $i = 0 Get-content -path z:\path\name.txt | fo
也许是这样的
1 computer-name update ncncncncn cncncncncncn date time
2 computer name.....
1 computer-name update ncncncncn cncncncncncn date time
2 computer name.....
#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++
}