Modifying Shares

There are three items that can be modified on a share: the maximum number of allowed users, the description, and the security settings. Two of these settings are very easy to modify: description and maximum allowed users. Modifying the security setting is a bit more of a challenge.

In the SetShareInfo.ps1 script, you create four variables that are used to hold information for the script. The first, $shareName, holds the name of the share that will be modified. Because WMI expects the name of the share to be enclosed in single quotes, include them here inside the double quotes. The next variable that is created is $wmiClass, which is used to hold the name of the WMI class to query. Since you are working with the Win32_Share class, ...

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.