This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Script for Quest Powershell in order to pull data from AD

Hi All, im new to powershell and need to extract out some data.

I would like to extract below attributes from AD for a User. Could you please help me in fixing the script.


Get-QADUser t70869 | select -ObjectAttributes samAccountName, givenName, sn, displayName, description, mail,proxyaddresses,canonicalname, dn,extensionAttribute1,extensionAttribute5,extensionAttribute9,extensionAttribute14, extensionAttribute15 | export-csv C:\Users\t70869\Documents\Temp\test3.csv

SamAccountName
givenname
sn
DisplayName
Description
mail
mailNickname
ProxyAddresses
targetAddress
CanonicalName
DN
extensionAttribute1
extensionAttribute5
extensionAttribute9
extensionAttribute14
extensionAttribute15

Parents
  • Yup, proxy addresses aree a bit trickier to deal with as you need to take that system string and convert it to a regular string.

    The line starting with $_.proxyaddresses is where that attribute gets fixed for your output.

    This is a clumsy solution but I think it will get you what you want:

    (If you don't like the '##' between the proxy addresses, just change it to something else)

    Get-QADUser t70869 -includedproperties extensionAttribute1,extensionAttribute5,extensionAttribute9,extensionAttribute14,extensionAttribute15 | %{

    $_.proxyaddresses | %{ $Addr = $_ + "##"; $AddrList = $AddrList + $Addr}

    $_ | Add-Member -MemberType NoteProperty -Name ProxyAddressString -Value $AddrList

    $_ | select samAccountName, givenName, sn, displayName, description, mail,proxyaddressString,canonicalname, dn,extensionAttribute1,extensionAttribute5,extensionAttribute9,extensionAttribute14, extensionAttribute15 | export-csv C:\Users\t70869\Documents\Temp\test03.csv -NoTypeInformation -Append

    }
Reply
  • Yup, proxy addresses aree a bit trickier to deal with as you need to take that system string and convert it to a regular string.

    The line starting with $_.proxyaddresses is where that attribute gets fixed for your output.

    This is a clumsy solution but I think it will get you what you want:

    (If you don't like the '##' between the proxy addresses, just change it to something else)

    Get-QADUser t70869 -includedproperties extensionAttribute1,extensionAttribute5,extensionAttribute9,extensionAttribute14,extensionAttribute15 | %{

    $_.proxyaddresses | %{ $Addr = $_ + "##"; $AddrList = $AddrList + $Addr}

    $_ | Add-Member -MemberType NoteProperty -Name ProxyAddressString -Value $AddrList

    $_ | select samAccountName, givenName, sn, displayName, description, mail,proxyaddressString,canonicalname, dn,extensionAttribute1,extensionAttribute5,extensionAttribute9,extensionAttribute14, extensionAttribute15 | export-csv C:\Users\t70869\Documents\Temp\test03.csv -NoTypeInformation -Append

    }
Children
No Data