What's New

PowerShell: Creating Multiple Folders

So you were scheduled to create many, many, many folders within a network share folder. Well, PowerShell will save you life one day! It did for me :). Here is the coding I used to get this to work for me. I didn’t get to involve with the permission part, but if you guys have something better then this please comment and share your knowledge.

$Users = Get-Content "C:\Users\BJ\Desktop\ADuser.txt"
ForEach ($user in $users)
{
$newPath = Join-Path "\\BJ-Share\User" -childpath $user
New-Item $newPath -type directory
}

note:

  1. $newPath = Join-Path “\\BJ-Share\User” -childpath $user \\if the User folder does not exist it will be created for you 🙂
  2. ADuser.txt – can be named anything, also the format within the text file is simple just type in the name of the folder and hit enter for each folder name. example: click here

If this post helped you, PLEASE take the time to +1 it.

About BjTechNews (1091 Articles)
An IT guy trying to learn everything about technology and sharing it with you all. I'm a blogger and video blogger who highlights daily news in the tech industry, promoting tips and hacks for fellow techies.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from BTNHD

Subscribe now to keep reading and get access to the full archive.

Continue reading