penfold Posted April 27, 2016 Posted April 27, 2016 I'm trying to get information from the Description field from our accounts in AD. I'm using the following powershell command to try and get the description field of an AD account. $Description= Get-ADUser $row.samaccountname -Properties Description | Select-object Description but this give me an output of @{Description=Actual Description} rather than just Actual Description I want to use the $description as a variable as I want to add to it but I can't seem to get it to work. Can anyone point me in the right direction?
pcstru Posted April 27, 2016 Posted April 27, 2016 $Description= Get-ADUser -Identity $row.samaccountname -Properties Description | foreach-object { $_.Description } In cases where Get-AdUser returns multiple rows, $Description will be set to the last one. 1
jinnantonnixx Posted April 27, 2016 Posted April 27, 2016 (edited) get-members is your friend $Description | gm will show that the description is a note property. To get the contents of this, reference the 'description' field of your variable. So to get your text, you should reference $Description.description Edit - your result is showing that you're returning an array, so pcstru's advice is good. Edited April 27, 2016 by jinnantonnixx
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now