I’m looking to replace our Bulk AD create VB script with PowerShell. With VBS we can create users home drives and assign permissions.
I’m very new to PS and have been looking around at comands and syntax but I can’t seem to find what I need. Anyone know of a way to add the Home drive path to a user during a PS creation. So far this is what i’m working with…
I would like to add to this to create the users home drive with something like \server\home$%username% and if possible also add the logon script info…
Foreach ($User in $UserInformation){
$CN = $User.samAccountName
$SN = $User.Surname
$Given = $User.givenName
$samAccountName = $User.samAccountName
$Display = $User.DisplayName
$User = $UserPath.Create(“User”,“CN=$CN”)
Write-Host “Creating User: $User.samAccountName”
$User.Put(“samAccountName”,$samAccountName)
$User.Put(“sn”,$SN)
$User.Put(“givenName”,$Given)
$User.Put(“displayName”,$Display)
$User.Put(“mail”,“$samAccountName@$domain”)
$User.Put(“userPrincipalName”,“$samAccountName@$domain”)
$User.SetInfo()
$Pwrd = $User.Password
$User.psbase.invoke(“setPassword”,$Pwrd)
$User.psbase.invokeSet(“AccountDisabled”,$False)
$User.psbase.CommitChanges()