Hi guys,
I'm a little stumped. I'm trying to write a script which creates a list of users form a CSV file and then also adds them to a list of groups which is also store din the CSV file. so far I have the following:
[code]$Users = import-csv c:\LNewCoUsers.csv
foreach ($user in $users) {
new-aduser -name $_.fullname -displayname $_.fullname -givenname $_.firstname -surname $_.surname -samaccountname $_.logonname -office $_.office -Description $_.jobdescription -homedrive "F:" -homedirectory $_.homedirectory
-userprincipalname $_.upn -accountpassword (ConvertTo-SecureString -AsPlainText "Password1234" -Force) -path "ou=Users,ou=UK,dc=lnewco,dc=local" -scriptpath drives_all.vbs -enabled:$true
$Groups = import-csv c:\lnewcodefaultgroups.csv
}
[/code]
This bit works perfectly for creating the users but I dont know how to then add the users to the groups in the same script.
Can anyone provide me with some inspiration?