我必须在广告中修改一些电话号码。
这是我想要做的。
$test1 = get-aduser -filter * -Properties * | Select-Object SamAccountName,OfficePhone | Sort-Object -Property SamAccountName | Where-Object {$_.OfficePhone -match "xxx-xxx-xxxx"}
这是输出:
SamAccountName OfficePhone
-------------- -----------
user1 xxx-xxx-xxxx,ext
so i want to replace
$test1 -replace 'xxx-xxx-xxxx','newphonenumber'
但是输出看起来像:
@{SamAccountName=user1; OfficePhone=newphonenumber,ext}
然后,当我尝试选择对象OfficePhone
时,该值为空。