PC Review


Reply
Thread Tools Rate Thread

gathering drive information - command line

 
 
steven
Guest
Posts: n/a
 
      16th Jan 2004
I need a way to gather disk information from command
line,, I just need local logical drive letters captured in
an aschii file, comma delimited,, in the following format
servername,C,D,E,F
 
Reply With Quote
 
 
 
 
Matthias Tacke
Guest
Posts: n/a
 
      16th Jan 2004
"steven" wrote:

>I need a way to gather disk information from command
>line,, I just need local logical drive letters captured in
>an aschii file, comma delimited,, in the following format
>servername,C,D,E,F


Hello Stven,
with the free psinfo out of pstools from www.sysinternals.com
the following batch will do for all servers in the var SrvList and
their *Fixed* disks. This requires your account has the rights on the
remote servers.

If you want cd-rom drive letters too, you should
change: find "Fixed"
to : findstr "Fixed CD-ROM"


@echo off & setlocal EnableExtensions EnableDelayedExpansion
set SrvList=Iterno Mars
for %%A in (%SrvList%) do (
set DrvInf=%%A
echo/Server: [!DrvInf!]
for /F "tokens=1 delims=:" %%B in ('psinfo \\!DrvInf! -d^|find "Fixed"') do (
set d=%%B
set DrvInf=!DrvInf!,!d:~-1!
)
echo/!DrvInf!
REM echo/!DrvInf!>testfile.txt
)

HTH
--
Greetings
Matthias________________________________________
For help on nt commands enter in a cmd window:
W2K>HH windows.chm::ntcmds.htm XP>HH ntcmds.chm
 
Reply With Quote
 
 
 
 
Guest
Posts: n/a
 
      16th Jan 2004

>-----Original Message-----
>"steven" wrote:
>
>>I need a way to gather disk information from command
>>line,, I just need local logical drive letters captured

in
>>an aschii file, comma delimited,, in the following format
>>servername,C,D,E,F

>
>Hello Stven,
>with the free psinfo out of pstools from

www.sysinternals.com
>the following batch will do for all servers in the var

SrvList and
>their *Fixed* disks. This requires your account has the

rights on the
>remote servers.
>
>If you want cd-rom drive letters too, you should
>change: find "Fixed"
>to : findstr "Fixed CD-ROM"
>
>
>@echo off & setlocal EnableExtensions

EnableDelayedExpansion
>set SrvList=Iterno Mars
>for %%A in (%SrvList%) do (
>set DrvInf=%%A
>echo/Server: [!DrvInf!]
>for /F "tokens=1 delims=:" %%B in ('psinfo \\!DrvInf! -

d^|find "Fixed"') do (
>set d=%%B
>set DrvInf=!DrvInf!,!d:~-1!
>)
>echo/!DrvInf!
>REM echo/!DrvInf!>testfile.txt
>)
>
>HTH
>--
>Greetings
>Matthias________________________________________
>For help on nt commands enter in a cmd window:
>W2K>HH windows.chm::ntcmds.htm XP>HH ntcmds.chm
>.
>Mathew,, thanks,, can you tell me what some of the

variables are so that I can customize,,srvinfo takes
hostnames? are they comma delimited,, how do I change the
location of the txtfile?
 
Reply With Quote
 
Matthias Tacke
Guest
Posts: n/a
 
      16th Jan 2004
<(E-Mail Removed)> schrieb
<snip>
> >-----Original Message-----
> >"steven" wrote:
> >
> >If you want cd-rom drive letters too, you should
> >change: find "Fixed"
> >to : findstr "Fixed CD-ROM"
> >
> >
> >@echo off & setlocal EnableExtensions

> EnableDelayedExpansion
> >set SrvList=Iterno Mars


This are computer names at my location, simply insert your own.
You could also use a plain vanilla textfile in every line a name.
In that case the following line has to be changed:
for /f "tokens=*" %%A in (yourfilename) do (

> >for %%A in (%SrvList%) do (
> >set DrvInf=%%A
> >echo/Server: [!DrvInf!]
> >for /F "tokens=1 delims=:" %%B in ('psinfo \\!DrvInf! -d^|find "Fixed"')

do (
> >set d=%%B
> >set DrvInf=!DrvInf!,!d:~-1!
> >)
> >echo/!DrvInf!
> >REM echo/!DrvInf!>testfile.txt
> >)

To really write to a file, remove the REM and place
your wished filename behind a doubles >> to append to that file

echo/!DrvInf! >>C:\yourpath\yourfile.tyt


> >Mathew,, thanks,, can you tell me what some of the

> variables are so that I can customize,,srvinfo takes
> hostnames? are they comma delimited,, how do I change the
> location of the txtfile?


Matthias, please.
Look at the normal output of "psinfo -d" at the command line.
The find or findstr removes all unrelevant information.
The for command uses the colon via "delims=:" to split the
resulting lines at the colon and only uses the first part as
advised through "tokens=1". The Var %%B thus contains " x"
which is shortened to the last char and appended to the
var DrvInf. The exclamation marks instead of percent signs
are necessary for delayed expansion. For help on the used
commands enter in a comd window:

setlocal /?
for /?
set /?

This is the sample output at my location with only Fixed:

Server: [Iterno]
Iterno,C,E
Server: [Mars]
Mars,C,D,E,F

HTH

--
Greetings
Matthias



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel always says gathering information when starting Dennis Microsoft Excel Setup 0 7th Apr 2004 08:44 PM
Starting Excel get Gathering Information everytime =?Utf-8?B?TWF0dCBU?= Microsoft Excel Crashes 0 20th Jan 2004 08:26 PM
command line - gathering drive information sjl Microsoft Windows 2000 1 16th Jan 2004 01:12 AM
TS is currently gathering information about this server Greg Microsoft Windows 2000 Terminal Server Applications 4 1st Nov 2003 12:15 AM
Re: terminal server manager gathering information Tom Decaluwe Microsoft Windows 2000 Terminal Server Applications 1 22nd Sep 2003 08:00 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:02 PM.