如何在输出文件中正确使用 $_?这是我的代码:
get-content computers.txt |
Where {$_ -AND (Test-Connection $_ -Quiet)} |
foreach { Get-Hotfix -computername $_ } |
Select CSName,Description,HotFixID,InstalledBy,InstalledOn |
convertto-csv | out-file "C:\$_.csv"
我正在尝试为文本文件中列出的所有计算机执行 get-hotfix,然后我希望它们以计算机名称作为文件名导出到 CSV。