如何添加文字" test"到每个选定用户的HomeDrive-Path的末尾?
Get-ADUser -filter * -properties EmailAddress, HomeDirectory -SearchBase "OU=Teacher,OU=__User Accounts,DC=school,DC=local" |
select EmailAddress, HomeDirectory |
ConvertTo-Csv |
Out-File c:\temp\teacher.csv
答案 0 :(得分:0)
您可以使用选择表达式:
Get-ADUser -filter * -properties EmailAddress, HomeDirectory -SearchBase "OU=Teacher,OU=__User Accounts,DC=school,DC=local" |
select EmailAddress, @{l="HomeDirectory"; e={"{0}test" -f $_.HomeDirectory}} |
ConvertTo-Csv |
Out-File c:\temp\teacher.csv
哪里" l"是新物业的标签," e"是属性的定义/表达式(在本例中,它是一个格式字符串)