1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
#Creating folders for each user Set-Location F:\power\ #User list in a file ForEach($user in Get-Content .\names.txt) { #Create folder for each user #If the item you are trying to create already exists #Override the default behavior New-Item $user -ItemType directory -Force #For each user create 3 folders more #Create Multiple New Folders in user directory $foldersname="folder1","folder2","folder3" foreach($folder in $foldersname) { New-Item $user\$folder -ItemType directory -Force } } |