Solved

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

Posted on 2014-09-05
7
365 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

 
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 40

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

Has Powershell sent you back into the Stone Age?

If managing Active Directory using Windows Powershell® is making you feel like you stepped back in time, you are not alone.  For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why.

Question has a verified solution.

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

Always backup Domain, SYSVOL etc.using processes according to Microsoft Best Practices. This is meant as a disaster recovery process for small environments that did not implement backup processes and did not run a secondary domain controller that ne…
Had a business requirement to store the mobile number in an environmental variable. This is just a quick article on how this was done.
This tutorial will walk an individual through the steps necessary to enable the VMware\Hyper-V licensed feature of Backup Exec 2012. In addition, how to add a VMware server and configure a backup job. The first step is to acquire the necessary licen…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

726 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