-4
我能夠導出我的Active Directory OU賬戶CSV文件刪除「OU =域控制器」但問題是,我得到這樣的輸出:在導出的CSV文件在PowerShell中
"Domain Controllers","OU=Domain Controllers,DC=testlab,DC=com"
我只是想有一個輸出就像這樣:
"Domain Controllers","DC=testlab,DC=com"
這裏是我的腳本現在:
import-module activedirectory
Get-ADOrganizationalUnit -filter * | select Name,@{l='DistinguishedName';e={($_.DistinguishedName)}} | Export-Csv -Path "C:\temp\ADOrganizationalUnitsexport.csv" -NoTypeInformation
猜你甚至沒有試圖研究這個自己,就像你會發現'Replace'完全符合你的要求。 –
[PowerShell從字符串中刪除文本]的可能重複(https://stackoverflow.com/questions/19168475/powershell-to-remove-text-from-a-string) –