Network Administrator Knowledgebase

Feb 27 2009   6:07PM GMT

Small script to get “Disks Configuration” from remote computer / server

Michael Khanin Michael Khanin Profile: Michael Khanin

This small scripts allows to get information from remote computer / server. All data will  be saved in XML format. Create a .bat file and put into in the following context:

@Echo off

Rem .
Rem . http://thesystemadministrator.com -  http://www.admininfo.ca
Rem .

@Echo Please wait….

SET STOREPATH=C:\TMP
SET RCOMP= “Put here IP or Name of remote computer / server”

set DM=ADMININFO
set USR=ADM
set PASS=PASSWORD

NET USE \\%RCOMP%\ipc$ /user:%DM%\%USR% %PASS%  > NUL 2>&1

REM ………. Checking OS Version ……….
For /F “Tokens=1,2,3* Delims= ” %%a in (‘@REG QUERY “\\%RCOMP%\HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion” /v ProductName^| find /i “ProductName”‘) Do SET OSVER=%%d
IF “%OSVER%” == “Windows 2000″ @Echo %OSVER% &goto :EOF

@echo ^<?xml version=”1.0″ encoding=”ISO-8859-1″?^> > %STOREPATH%\%RCOMP%_CompInfo.xml
@echo ^<Report^>^<Lang^>en^</Lang^> >> %STOREPATH%\%RCOMP%_CompInfo.xml
@echo ^<Title^>Report of %RCOMP%^</Title^> >> %STOREPATH%\%RCOMP%_CompInfo.xml

REM ………. Disks Configuration ……….
@echo ^<Group^>^<Title^>Disks Configuration^</Title^>  >> %STOREPATH%\%RCOMP%_CompInfo.xml
For /F “Tokens=1-5 Delims=,” %%a in (‘”@WMIC /node:%RCOMP% /user:”%DM%\%USR%” /password:%PASS% DISKDRIVE get Model, InterfaceType, Partitions, MediaType /format:csv.xsl | find /i “1″”‘) Do @echo ^<Item^>^<Model^>%%d^</Model^>^<InterfaceType^>%%b^</InterfaceType^>^<MediaType^>%%c^</MediaType^>^<Parts^>%%e^</Parts^>^</Item^> >> %STOREPATH%\%RCOMP%_CompInfo.xml
@echo ^</Group^> >> %STOREPATH%\%RCOMP%_CompInfo.xml
REM ………. Disks Configuration ……….

@echo ^</Report^> >> %STOREPATH%\%RCOMP%_CompInfo.xml

Note: Remember to set IP or Name of remote computer / server

That it!

 Comment on this Post

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when other members comment.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to: