Advertisements
TRENDING

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.

Advertisements
About BjTechNews (905 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

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s