PowerShell for Windows Admins

Apr 2 2010   11:14AM GMT

Shares: Discovering

Richard Siddaway Richard Siddaway Profile: Richard Siddaway


As I said last time I’ve modified the Get-Share function to accept a share name.

function Get-Share {
param (
    if (!$name) {Get-WmiObject -Class Win32_Share}
    else {Get-WmiObject -Class Win32_Share -Filter "Name=’$name’"}

if a name isn’t provided that all shares are returned.  If we supply a name only that share is returned. In either case we can put the object onto the pipeline and perform further processing.

Get-Share | ft name, maximumallowed, description

Get-Share -name test1 | fl name, maximumallowed, description

 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: