PowerShell for Windows Admins

Mar 6 2010   6:06AM GMT

Share Type

Richard Siddaway Richard Siddaway Profile: Richard Siddaway

 

One other point we need to cover is the type of share.  We have a number of choices as shown in the script.  The Type property has to be converted from a number to an understandable value – unless you want to learn the share types off by heart.

001
002
003
004
005
006
007
008
009
010
011
012
013
014
015
016
$shtyp = DATA {
ConvertFrom-StringData -StringData @’
0 = Disk Drive
1= Print Queue
2 = Device
3 = IPC
2147483648 = Disk Drive Admin
2147483649 = Print Queue Admin
2147483650 = Device Admin
2147483651= IPC Admin
‘@

}

Get-WmiObject -Class Win32_Share | 
select Name, Path, Description,
@{Name="ShareType"; Expression = {$shtyp["$($_.Type)"]}}

A calculated field can be used to derive the share type as shown.

Technorati Tags: ,,

 Comment on this Post

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when other members comment.

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

Share this item with your network: