Extract list of properties from AD user objects to XML



I'm using this powershell script, http://ift.tt/1uCCGHI, to extract properties from AD user objects.


When I run this command:


.\Get-UserADProperties2.ps1 givenName,sn,department,mail,telephoneNumber -searchroot 'http://LDAPou=users,ou=EMP,dc=emp,dc=company,dc=com' | Export-Clixml C:\XML\ADInfo.xml


the tags in the xml file look like this:



<Obj RefId="1">
<TNRef RefId="0" />
<MS>
<S N="department">Information Systems</S>
<S N="mail">jane.doe@company.com</S>
<S N="sn">Doe</S>
</MS>
</Obj>


How can I get the export so the tags look like this:



<Obj RefId="1">
<TNRef RefId="0" />
<MS>
<department>Information Systems</department>
<mail>jane.doe@company.com</mail>
<lname>Doe</lname>
</MS>
</Obj>

No comments:

Post a Comment