add-pssnapin quest.activeroles.admanagement $date = (get-date).ToString() $DistinguishedName = get-content C:\TEMP\90InactiveMoves\SSCtest.txt | foreach-object {get-qaduser $_ -Service 'My server.com' -SearchRoot 'Mydomain.com/BLA/users' -properties DistinguishedName} get-content C:\TEMP\90Moves\SSCtest.txt | foreach-object {get-qaduser $_ -Service 'Myserver.com' -SearchRoot 'mydomain.com/ssc/users' -Enabled | Disable-QADUser | set-qaduser -Description "Account disabled on $date, $DistinguishedName" |Move-QADObject -Service 'Myserver.com' -NewParentContainer 'MyDomain.com/Inactive users'}
Need some help. I am trying to update the 'Description' Field of a list of AD users with two variables I need to pass. One is the date, which works fine, the other is the DistinguishedName. What Im doing is a bulk user move here and need the account stamped with the date it was moved and the old OU path it originated at before it was moved in case it needs to go back. Can someone look at this and maybe suguest a way to get the DistinguishedName part done? My script works fine but I am stuck on the DistinguishedName part. I pass it as a variable by looking up the account DistinguishedName and passing it as the variable but this is sketchy at best. Thanks for the help: