Reputation: 21
Please someone help me to create a batch file though which I can extract the UNC path of all shares available in one server. Its very tedious to manually find out from server manager as I have to open properties of every share folder and take the UNC path from it. Is there any specific powershell command or a batch script which I can run to extract for all available share folders. Thanks in advance for your help.
Upvotes: 1
Views: 3319
Reputation: 1
You can use WMI specifically WIN32_Share to get Share Name, Path, and Description, then pipe the reply into a loop. Format the output to provide the UNC path, or send the output to a file
$SrvName = "YourServer"
gwmi -class win32_share -computer $SrvName | ForEach-Object {("\\"+$SrvName + "\" + $_.Name)}
Upvotes: 0
Reputation: 70933
Get it from wmi
wmic /node:yourServer share get name,path /format:csv
Upvotes: 2