Tag Archives: Win32_Share

New article on PowerShell Magazine: Select non-administrative shared folders using Win32_Share WMI class

Today’s tip is on how to use the Type property of the Win32_Share class to select only non-administrative shares from a local or remote system. This class can be used in combination with the Get-WmiObject or Get-CimInstance cmdlets to gather this data. The examples in this articles show how this can be used against a remote system. The article is available on PowerShell Magazine:

http://www.powershellmagazine.com/2014/07/24/pstip-select-non-administrative-shared-folders-using-win32_share-wmi-class/

Share

QuickTip: Using Win32_Share to only select non-default shares

The Win32_Share class can be used to remotely or locally gather a listed of shared folders and their properties. Since every Windows system by default has a number of standard shared folder it can be interesting to only select the non-default shares. The following line of code allows you to do that:

Get-WmiObject Win32_Share | Where-Object {(@('Remote Admin','Default share','Remote IPC') -notcontains $_.Description)}

Note that this only works for systems with English localization options. For other languages the names in the array will have to be changed to match to localized names.

Share