#29394 - 2002-09-23 07:07 PM
Re: WMIQuery DriveType 3 list
|
Anonymous
Anonymous
Unregistered
|
Waltz,
This worked:
code:
if exist ("s:\computing\scripts\wksta\" + @wksta + "_dr.txt") goto "over" else $PC = @wksta $outfile = "s:\computing\scripts\wksta\" + @wksta + "_dr.txt" For Each $Disk In DiskInfo($PC) if redirectoutput ("") = 0 ; send it to the screen $Disk ? endif if redirectoutput ($outfile,1) = 0 ; send it to the file $Disk ? endif Next endif ; send it to the screen if redirectoutput ("") = 0 ? "stuff for the screen" endif
If I didn't have the ENDIFs after the redirectoutput commands I'd get a FOR WITHOUT NEXT error.
I took out the RETURN. I have no idea why that was in there. It was in the code I pirated from Kholm so I left it there.
Thanks! [ 23. September 2002, 19:14: Message edited by: Shane ]
|
|
Top
|
|
|
|
#29396 - 2002-09-23 07:24 PM
Re: WMIQuery DriveType 3 list
|
Radimus
Moderator
   
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
have you looked at?:
"Select * from Win32_DiskPartition"
Access: Availability: BlockSize: 512 Bootable: -1 BootPartition: -1 Caption: Disk #0, Partition #0 ConfigManagerErrorCode: ConfigManagerUserConfig: CreationClassName: Win32_DiskPartition Description: Installable File System DeviceID: Disk #0, Partition #0 DiskIndex: 0 ErrorCleared: ErrorDescription: ErrorMethodology: HiddenSectors: Index: 0 InstallDate: LastErrorCode: Name: Disk #0, Partition #0 NumberOfBlocks: 39085137 PNPDeviceID: PowerManagementCapabilities: PowerManagementSupported: PrimaryPartition: -1 Purpose: RewritePartition: Size: 20011590144 StartingOffset: 32256 Status: StatusInfo: SystemCreationClassName: Win32_ComputerSystem SystemName: RADIMUS Type: Installable File System [ 23. September 2002, 19:26: Message edited by: Radimus ]
|
|
Top
|
|
|
|
#29397 - 2002-09-23 07:35 PM
Re: WMIQuery DriveType 3 list
|
Anonymous
Anonymous
Unregistered
|
Radimus:
Er, no, I haven't. Not that I would know what to do with it if I did, though. If you hadn't noticed I don't really know what I'm doing. I take scripts other people have done and modify them, if I can, to my own ends (Script Pirate?). If I can't modify it then I ask for help. But, thanks for the pointer; I'll file it away.
Anyhoo, I got your bit of code to do what I want (assuming it lists all local partitions, which I can't test yet):
code:
$name= split(wmiquery("name","win32_logicalDisk",,"DriveType","3"),"|") $fs= split(wmiquery("filesystem","win32_logicalDisk",,"DriveType","3"),"|") $size= split(wmiquery("size","win32_logicalDisk",,"DriveType","3"),"|") $fsp= split(wmiquery("freespace","win32_logicalDisk",,"DriveType","3"),"|")
if open (1,"s:\computing\scripts\wksta\" + @wksta + "_testdr.txt",5) = 0 for $loop=0 to ubound($name) ? @wksta + chr(9) + $name[$loop] + chr(9) + $fs[$loop] + chr(9) + $size[$loop] + chr(9) + $fsp[$loop] writeline(1, @wksta + chr(9) + $name[$loop] + chr(9) + $fs[$loop] + chr(9) + $size[$loop] + chr(9) + $fsp[$loop] + chr(13) + chr(10)) next close(1) endif
So, see, I learn a bit from the things folks here show me. The responses in this thread have been a great help.
|
|
Top
|
|
|
|
#29398 - 2002-09-23 07:51 PM
Re: WMIQuery DriveType 3 list
|
Radimus
Moderator
   
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
you could also do...
code:
for $loop=0 to ubound($name) $hd =$size[$loop] $hdGB =left($hd,len($hd)-9) $hdf =$fsp[$loop] $hdGBf =left($hdf,len($hdf)-9)
? $name[$loop]" "$fs[$loop]" "$hdGB"GB "$hdGBf"GB" next
|
|
Top
|
|
|
|
#29399 - 2002-09-24 01:51 AM
Re: WMIQuery DriveType 3 list
|
Anonymous
Anonymous
Unregistered
|
I managed to test this:
code:
$name= split(wmiquery("name","win32_logicalDisk",,"DriveType","3"),"|") $fs= split(wmiquery("filesystem","win32_logicalDisk",,"DriveType","3"),"|") $size= split(wmiquery("size","win32_logicalDisk",,"DriveType","3"),"|") $fsp= split(wmiquery("freespace","win32_logicalDisk",,"DriveType","3"),"|")
if open (1,"s:\computing\scripts\wksta\" + @wksta + "_testdr.txt",5) = 0 for $loop=0 to ubound($name) ? @wksta + chr(9) + $name[$loop] + chr(9) + $fs[$loop] + chr(9) + $size[$loop] + chr(9) + $fsp[$loop] writeline(1, @wksta + chr(9) + $name[$loop] + chr(9) + $fs[$loop] + chr(9) + $size[$loop] + chr(9) + $fsp[$loop] + chr(13) + chr(10)) next close(1) endif
...on a system with lots of drives and partitions and it does indeed list each partition on its own line, just like I had hoped it would. Thanks, Radimus!
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 657 anonymous users online.
|
|
|