PowerShell – Make Sub directors in a list of folders


A real quick one today, I had a need come up to make a folder in the Home Drive of every user for them to place any .PST files they want to be imported for an Exchange migration.

I was able to write a real quick Powershell script to do this as I know all were all of the home directors are within the network for this set of users. if they had been a bit more over the place I should have used a Get-ADUser to get the home directors but in this case, didn’t really need to do that.

$path = "\\domain.local\DFS\user01"

$folders = Get-ChildItem -Path $path -director

foreach ($user in $folders) {

New-Item -ItemType Directory -Path "$path\$user\Folder-for-PSTs"}