Solved

Want to extract all Shares on my domain with computer names.

Posted on 2014-09-05
7
335 Views
Last Modified: 2014-09-12
I have list of computers in txt format. I need to get all shares folder with the shared path e.g

\\serverexchange\tic
0
Comment
Question by:SAIMSKY ADMIN
7 Comments
 
LVL 9

Expert Comment

by:Ashok Dewan
ID: 40305632
check this below link. I hope you will find it helpful.

http://www.softperfect.com/products/networkscanner/

Regards
Ashok Dewan
0
 

Author Comment

by:SAIMSKY ADMIN
ID: 40305634
Thanks Ashok  but i need powershell script if you can help .
thanks
0
 
LVL 16

Expert Comment

by:gurutc
ID: 40305636
this command:
Try this batch file:

setlocal enabledelayedexpansion
FOR /f %%i IN (serverlist.txt) DO call :inside %%i
GOTO :EOF
:inside
echo %1 >> sharelist.txt
net view \\%1 >> sharelist.txt
GOTO :EOF
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 40

Expert Comment

by:Subsun
ID: 40306124
Try this code.. Input the server names in C:\Server.txt.
GC C:\Server.txt | %{
$server = $_.Trim()
Write-host "Working on $server"
	Try{
	Get-WmiObject Win32_share -ComputerName $server -filter "type = 0" -ea Stop | Select __SERVER,Name,Path
	}Catch{
	$_.Exception | Select @{N="__SERVER";E={$server}},@{N="Name";E={$_.Message}},Path
	}
} | Export-Csv C:\Report.csv -nti

Open in new window

1
 
LVL 39

Expert Comment

by:footech
ID: 40306358
If you actually need the UNC path output, you can use the below.
GC C:\Server.txt | %{
   $server = $_.Trim()
   Get-WmiObject Win32_Share -ComputerName $server -filter "type = 0" | Select @{n="UNCPath";e={"\\$server\$($_.Name)"}}
}

Open in new window

1
 
LVL 40

Accepted Solution

by:
Subsun earned 500 total points
ID: 40306492
Incorporated footech's uncpath suggestion...
GC C:\Server.txt | %{
$server = $_.Trim()
Write-host "Working on $server"
	Try{
	Get-WmiObject Win32_share -ComputerName $server -filter "type = 0" -ea Stop | Select __SERVER,Name,Path,@{n="UNCPath";e={"\\$server\$($_.Name)"}}
	}Catch{
	$_.Exception | Select @{N="__SERVER";E={$server}},@{N="Name";E={$_.Message}},Path,UNCPath
	}
} | Export-Csv C:\Report.csv -nti

Open in new window

1
 

Author Closing Comment

by:SAIMSKY ADMIN
ID: 40318766
Thanks mate
0

Featured Post

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
This article explains how to install and use the NTBackup utility that comes with Windows Server.
This tutorial will give a an overview on how to deploy remote agents in Backup Exec 2012 to new servers. Click on the Backup Exec button in the upper left corner. From here, are global settings for the application such as connecting to a remote Back…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question