C:\aaa.csv
"IPAddress","FullDomainName","RequestedTargetGroupName"
"10.103.16.65","cnhzpd-ftdx8x1",""
"10.103.22.812","cnhz",""
"10.103.22.81","cnhzpd-hxdx8x1",""
#将ip是10.103.22.812的主机名属性改成SUCCESS Import-Csv -Path C:\aaa.csv | foreach { if ($_.ipaddress -eq ‘10.103.22.812‘) { $_.FullDomainName = ‘SUCCESS‘ } $_ } | Export-Csv -Path c:\aaa-upadte.csv -NoTypeInformation #将ip是10.103.22.812的最后一列属性值改成FAILURE Import-Csv -Path C:\aaa.csv | foreach { if ($_.ipaddress -eq ‘10.103.22.812‘) { $_.RequestedTargetGroupName = ‘FAILURE‘ } $_ } | Export-Csv -Path c:\aaa-upadte.csv -NoTypeInformation
时间: 2024-11-04 12:47:59