Collect LUN information from remote Windows servers

This is an odd article I am writing under a Linux blog! Oops! forgive me.

Requirement

You are assigned with a task to collect LUN information from hundreds of Windows servers.

Do it Manually if you like

Yes, if you have the time and patience you could surely go about it by collecting manually and you got it right, start logging in one-by-one on each server, 1st to 200th hundres for example, or make your life easy by using my script.

You are smart, I knew it!

Here's how to create the script.

Download Psexec and copy to a jump server. You know that from a jump server  all your target servers are reachable, right.

Prepare the script

You will need to create 3 files, and all are simple text files you could use notepad for this.

1. Llist of your servers or IP addresses - serverlist.txt
server0001
server0002
server0003
...
server1000

2. Type below 2 commands in this file and save it - script_win.bat
hostname

C:\"Program Files"\install\SDDDSM\datapath query device 

3. Enter the one line as shown below - command.bat
Psexec -c -f @c:\temp\serverlist.txt c:\temp\script_win.bat

That's it, your scripts are ready to run.

Upload scripts

Upload the 3 files to your jump server at your desired folders, and don't forget to replace the temp folder in the 3rd script with your actual paths.

Run !


You can start collecting that valuable information you always wanted by running the 3rd script, i.e. command.bat

If you you have done everything as I told you then you start getting the list of hostnams followed by the LUN information. You could redirect this to a file by using the > or >> re-direction symbols.


Psexec -c -f @c:\temp\serverlist.txt c:\temp\script_win.bat > results.txt
 
Cheers!

As always, you comments please :)


Comments

Popular posts from this blog

Install Puppet Client on RHEL 6.4

Install IBM Tivoli TSM 5.5 Backup Server (trial) on your Laptop using Linux KVM virtual machine

IBM TSM Client 5.x install (trial) on your Laptop using KVM Virtual Machines