Avatar of jjoz
jjoz
Flag for Australia asked on

How to list all shared network drive and display the UNC path along its size ?



Hi All,

I am trying to enumerate the Shared Network drive in my domain using powershell, but however in my simple script below why the result is different than the the UNC path that I can just copy paste ?

so I got: \\SIMGTP01\root\CIMV2:Win32_Share.Name="Z$"
instead of: \\SIMGTP01\Z$

$strComputer = "SIMGTP01","SIMGTP02"
$colItems = get-wmiobject -class "Win32_Share" -namespace "root\CIMV2" -computername $strComputer
$colItems | Select __SERVER, __PATH, Path, Caption | ft -AutoSize

Open in new window


__SERVER __PATH                                                  Path                                               Caption                     
-------- ------                                                  ----                                               -------                     
SIMGTP01 \\SIMGTP01\root\CIMV2:Win32_Share.Name="Z$"             Z:\                                                Default share               
SIMGTP01 \\SIMGTP01\root\CIMV2:Win32_Share.Name="C$"             C:\                                                Default share               
SIMGTP01 \\SIMGTP01\root\CIMV2:Win32_Share.Name="Webtrends"      F:\Webtrends                                       Temp Area for Webtrends Logs
SIMGTP01 \\SIMGTP01\root\CIMV2:Win32_Share.Name="May09"          F:\SPX Restore\May09                               May09                       
SIMGTP01 \\SIMGTP01\root\CIMV2:Win32_Share.Name="Common$"        F:\Common_Backup                                   Common$

Open in new window

PowershellActive DirectoryWindows Server 2008

Avatar of undefined
Last Comment
jjoz

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
soostibi

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
jjoz

ASKER
You are King of scripting man... !!! :-)
as for the size I guess I'll create another thread for it.
jjoz

ASKER
thanks !
jjoz

ASKER
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23