troubleshooting Question

AD Powershell Script to Create User

Avatar of Tim Ballin
Tim Ballin asked on
Active DirectoryPowershell
9 Comments1 Solution77 ViewsLast Modified:
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
}
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 9 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 9 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros