Creating Multiple Shares

There may be times when you need to create multiple shares simultaneously. One way to do this is to modify the CreateShare.ps1 script to accept multiple share names and folder names from the command line. To do this, use the CreateMultipleShares.ps1 script.

Example 5-15. CreateMultipleShares.ps1

param($folderPath, $shareName, $maxAllowed=5, $description="Created by PowerShell") function funHelp() { $helpText=@" NAME: CreateMultipleShares.ps1 Creates multiple shares on a local machine using default permissions The folder to be shared does not need to exist as the script checks for the existence of the folder and will create it if it is not present PARAMETERS: -folderPath Specifies the path to the folder you wish to share ...

Get Windows PowerShell™ Scripting Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.