Solved

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

Posted on 2014-09-05
7
357 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

A project that enables an administrator to perform actions within a user session context not just at the time of login but any time later on day(s) or week(s) later.
This article demonstrates probably the easiest way to configure domain-wide tier isolation within Active Directory. If you do not know tier isolation read https://technet.microsoft.com/en-us/windows-server-docs/security/securing-privileged-access/s…
This tutorial will show how to configure a new Backup Exec 2012 server and move an existing database to that server with the use of the BEUtility. Install Backup Exec 2012 on the new server and apply all of the latest hotfixes and service packs. The…
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.

732 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