Subscribe to RSS feed  Follow @jackvamvas - Twitter

*Use the Comments section for questions Links


SQL Server DBA Jobs

How to list computer shares with Powershell and WMI

31 December,2019 by Tom Collins

Question: How can I list shares from a server using Powershell and WMI ?  I've been tasked with auditing servers and identifying shares which are not authrorized

Answer:  The two main methods I use are 1) Get-Smbshare   and 2) get-WmiObject -class Win32_Share. 

Get-Smbshare examples

--list all SMB shares on a server


--list all SMB shares on a specific server

Get-Smbshare -CimSession "my_server_name

get-WmiObject -class Win32_Share examples

--list all share on the current server 

get-WmiObject -class Win32_Share

--list all shares on a remote server 

get-WmiObject -class Win32_Share -computer my_computer


Read more on Powershell and server management 

How create a drive to a network share with Powershell New-PSDrive

If you're interested in more Powershell scripts check Powershell scripts for DBA

Author: Tom Collins (


Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Your comment could not be posted. Error type:
Your comment has been posted. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.


Post a comment on How to list computer shares with Powershell and WMI | SQL Server Performance Tuning | SQL Server DBA:Everything | FAQ | Contact|Copyright & Disclaimer