Who doesn't need to check existing shares on a remote workstation or server? The President? Monks? That creapy guy who always seems to be watching you leave after work? They may not need to, but we in IT do. Since PowerShell has given us direct access into WMI it is very simple.
ONELINER
PEICE BY PEICE
GWMI win32_share -computer %COMPUTER_NAME%
Using PoSh native WMI through Get-WmiObject we are able to connect to the Win32_Share namespace: the namespace containing...Network Share Configurations!!
? {$_.name -notlike "*$"}
We want to filter out all Admin shares. Leave this section out to show all shares.
fl
Format the output as a list. Descriptions could be truncated when output as a table.ALIASES
GWMI = Get-WMIObject
? = Where-Object
fl = Format-List
0 comments:
Post a Comment