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
Get-Smbshare
--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
This is only a preview. Your comment has not yet been posted.
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.
Posted by: |