scfcu
asked on
Set-QADuser import from csv; Manager Attribute doesn't populate!!
I am new to scrripting however I currently have a CSV file that I am trying to use to import user attributes. All the attributes are importing except for the manager attribute. I have enterend the Distigushed Name for Manager in the proper location however it is not importing
The command I run from quest managment shell is
Import-Csv c:\users5.csv | Set-QADUser -Identity {$_.samAccountName} -import
the csv is popluated like so.
samAccountname,sn,givennam e,name,dis playname,t itle,depar tment,mana ger,teleph onenumber, physicalDe liveryOffi ceName
samname,name,sam,sam n,sam name,Admin,MIS,"CN=manager name,OU=Us ers,OU=oun ame,DC=dom ain,DC=com ",214-555- 1212,test
The command I run from quest managment shell is
Import-Csv c:\users5.csv | Set-QADUser -Identity {$_.samAccountName} -import
the csv is popluated like so.
samAccountname,sn,givennam
samname,name,sam,sam n,sam name,Admin,MIS,"CN=manager
ASKER
This did not work! Thanks though.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I also found this on powergui forum
Import-Csv C:\users4.csv | Select-Object -Property SamAccountName,@{'Name'='M anager';'E xpression' ={(Get-QAD User -Identity $_.Manager).dn}} | Set-QADUser -Identity {$_.SamAccountName}
I like yours better though. I can just add in the other attirbutes to your code.
Thanks Chris!
Randy
Import-Csv C:\users4.csv | Select-Object -Property SamAccountName,@{'Name'='M
I like yours better though. I can just add in the other attirbutes to your code.
Thanks Chris!
Randy
No worries.
Very odd that the version you have there works, the strings it returns are identical, and if they weren't right it would fail to find the manager.
Did they manage to give a reason why along with the work around at all?
Chris
ASKER
No they didn't, the only difference I guess between yours and the one on powergui.com is that the one on powergui will find the dn for the name you put in the csv and it will add it. Pretty cool! I am not sure why you have to specify the attribute for it to work though. Here is the link.
http://powergui.org/thread.jspa?threadID=7618&tstart=270
http://powergui.org/thread.jspa?threadID=7618&tstart=270
The odd thing is, your manager field is already a DN in the input here:
manager
"CN=managername,OU=Users,O U=ouname,D C=domain,D C=com"
I was testing on that basis, it should have worked (but doesn't appear to).
If you were using:
manager
managerusername
Then the solution would have made a lot of sense because it does the conversion to DN quite neatly.
Ah well, I'll test some more and see if there's something daft that's breaking it :)
Chris
manager
"CN=managername,OU=Users,O
I was testing on that basis, it should have worked (but doesn't appear to).
If you were using:
manager
managerusername
Then the solution would have made a lot of sense because it does the conversion to DN quite neatly.
Ah well, I'll test some more and see if there's something daft that's breaking it :)
Chris
Open in new window