Cannot Get Script to Create Network Folder RRS feed

  • Question

  • Hello All,

    I'm using a PowerShell script that I've found online and modified. It is supposed to create Active Directory Users from information found in a CSV file and create a unique shared folder for them as well as add them to a specific security group. It does all of this with the exception of creating the folder. It adds the correct drive letter and folder path in the Profile>Home Folder>Connect area of the users' properties but it doesn't actually create the folder. Any help is greatly appreciated. Thanks in advance. Here is the script:

    $UserList=IMPORT-CSV C:\FilePath\UserList.csv
    FOREACH ($Person in $UserList) {
    $Name=$Person.Firstname+" "+$Person.Lastname

    New-ADUser -Name $Name -GivenName $Person.Firstname -Surname $Person.Lastname -DisplayName $Name -SamAccountName $Username -HomeDrive "H:" -HomeDirectory $HDrive -UserPrincipalName $UPN -Path $OU
    Set-ADAccountPassword -Identity $Username -NewPassword (ConvertTo-SecureString -AsPlainText $Password -Force)
    Add-ADPrincipalGroupMembership -Identity $Username -MemberOf "Security Group"
    Enable-ADAccount -Identity $Username

    Matt Georgetti

    Tuesday, March 29, 2016 1:20 PM


All replies