The code for RemoveHomeFolders.ps1 is: # Remove share and directories $drive = "C" $homefolder = "home" Remove-SmbShare -Name $homefolder -Force Remove-Item -Path "$($drive):\$($homefolder)" -Force -Recurse