Hello,
I have to import values in a CVS File in AD LDS.
Here is my .csv sample file:
#TYPE Selected.Quest.ActiveRoles.ArsPowerShellSnapIn.Data.ArsUserObject "Name","mail","StreetAddress","street","DN","Company" "toto",,"3, maining street","miami","CN=toto,OU=Users,DC=XYZ,DC=local","toto Company" "michel",,"JO street","Vancouver","CN=michel,OU=Users,DC=XYZ,DC=local","Michel Company"
here is my Powershell code:
#Variables $SourceServer = "192.168.0.2:50000" $PathCSV = "test2.csv" $OU = "OU=Users,DC=XYZ,DC=local" #--- connect-QADService -service $SourceServer
Import-Csv $PathCSV | where {new-QADUser -ParentContainer $OU -name $_.name -Email $_.mail}
I have not shown all the attributes used for this example (-StreetAddress $_.StreetAddress ......) Ok, this code import values correctly, but i have the attributes that may change in the CSV source File...and i wonder if it's possible to not add all the parameters in new-QADUser => for example -City $_.city -Fax $_.fax .......
So, i tried to use the -Import parameter ( new-QADUser -ParentContainer $OU -Import), but this don't works...
Have you any ideas to import a full CSV file without indicate some new-QADUser parameters (which correspond to the user attributes) ?
Second Question, can you help me to write some code which import Users in their Company OU, and previously create the Company OU if it do not exist basing the CSV File
Regards,
FulG
|