O'Reilly logo

Windows PowerShell™ Scripting Guide by Ed Wilson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required