Microsoft® Windows® 2000 Scripting Guide
« Previous | Next »
For the most part, you should not share out every single folder on your computer. After all, doing so exposes all your documents and all your data to anyone browsing the network. Likewise, it potentially allows anyone to make changes to critical or confidential files and folders.
To guard against the possible misuse of shared folders, it is a good idea to periodically review the shared folders on a computer and then decide whether those folders should be shared at all. You can use the Win32_Share class to return information about the shared folders on a computer. The shared folder properties available through this class are shown in Table 11.11.
Table 11.11 Win32_Share Properties
Property | Description |
---|---|
AllowMaximum | Indicates whether or not the number of users allowed to simultaneously access this folder has been limited. If True, the value in the MaximumAllowed property is ignored. |
Caption | Description of the object. |
MaximumAllowed | Limit on the maximum number of users allowed to use this resource concurrently. The value is valid only if the AllowMaximum property is set to False. |
Name | Network name given to the shared folder. |
Path | Local path of the shared folder. |
Type | Type of resource being shared. Types include disk drives, print queues, interprocess communications (IPC), and general devices. Values are: 0 Disk drive 1 Print queue 2 Device 3 IPC 2147483648 Disk drive (Administrative share) 2147483649 Print queue (Administrative share) 2147483650 Device (Administrative share) 2147483651 IPC (Administrative share) |
The relationship between the Win32_Share class and Windows Explorer is shown in Figure 11.9.
Figure 11.9 Win32_Share and Windows Explorer
Win32_Share and Windows Explorer
Listing 11.32 contains a script that enumerates the properties of all the shared folders on a computer. To carry out this task, the script must perform the following steps:
This returns a collection of all the shared folders on the computer.
Listing 11.32 Enumerating Shared Folders
|
|
Send us your feedback | « Previous | Next » |