Avatar of Tim Ballin
Tim Ballin

asked on 

AD Powershell Script to Create User

I pulled this off Technet and I'm a little confused as to the purpose of line 4 "$homepath".  How does it differ from line 7 "$pathToShare"?  I'm just not sure how to customize this part of the script.

function CreateHomeDir
{
   Param([string]$user)
   $homepath="X:\Users\$user"
   $shareName="$user$"
   $Type=0
   $pathToShare="\\acmenet01\f$\Users\$user"
   New-Item -type directory -path $pathToShare|Out-Null
   $WMI=[wmiClass]"\\acmenet01\root\cimV2:Win32_Share" 
   $WMI.Create($homepath,$shareName,$Type)|Out-Null
}

Open in new window

PowershellActive Directory

Avatar of undefined
Last Comment
Tim Ballin

8/22/2022 - Mon