Solved

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

Posted on 2014-09-05
7
319 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
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 
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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

OfficeMate Freezes on login or does not load after login credentials are input.
A safe way to clean winsxs folder from your windows server 2008 R2 editions
This tutorial will walk an individual through the steps necessary to install and configure the Windows Server Backup Utility. Directly connect an external storage device such as a USB drive, or CD\DVD burner: If the device is a USB drive, ensure i…
This tutorial will walk an individual through the process of configuring their Windows Server 2012 domain controller to synchronize its time with a trusted, external resource. Use Google, Bing, or other preferred search engine to locate trusted NTP …

914 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now