modify script


hi,

i use ps script data:

get-qaduser -sizelimit 0 -searchroot 'domain.com/ou/ou1test' -includedproperties samaccountname,name,title,parentcontainer,streetaddress,telephonenumber,manager | sort-object -property samaccountname | select samaccountname,name,title,parentcontainer,streetaddress,telephonenumber,manager | export-csv e:\data.csv -encoding unicode

 

in data.csv in manager column have

cn=john johnson ,ou=sales ,ou=hq,ou=company ,dc=domain ,dc=ru

but need only

john johnson

help me please modify script.

thanks in advanced

try this:

  get-qaduser -sizelimit 0 -searchroot 'domain.com/ou/ou1test' -includedproperties `     samaccountname,name,title,parentcontainer,streetaddress,telephonenumber,manager | `     sort-object -property samaccountname | `     select samaccountname,name,title,parentcontainer,streetaddress,telephonenumber,`          @{n='manager';e={($_.manager -split ',')[0] -replace 'cn='}} | `     export-csv e:\data.csv -encoding unicode  


grant ward, a.k.a. bigteddy

what's new in powershell 3.0 (technet wiki)

network live audit - powershell script


Windows Server  >  Windows PowerShell



Comments

Popular posts from this blog

Error: 0x80073701 when trying to add Print Services Role in Windows 2012 Standard

Disconnecting from a Windows Server 2012 R2 file sharing session on a Windows 7,8,10 machine

Event ID 64,77,1008 Certificates Events Windows Server 2008, 2008R2