thanks for the help..Sidewinder..!! it works nice under Admin accounts..
the only thing is that when i try to use this driveinfo.vbs in a guest account on win xp pro it gives me this error:
E:\driveinfo.vbs(7, 1) Microsoft VBScript runtime error: Permission denied: 'GetObject'
and it also wont follow through by copying the drives infos over to the report.inf
is there anyway at all to make this script work propperly in a guest account..
gumbaz,
This script is self-contained, no need for any batch files or supporting VBScripts.
Const ForAppending = 8
strComputer = "."
Set objArgs = WScript.Arguments
Set fso = CreateObject("Scripting.FileSystemObject")
Set wmiServices = GetObject ("winmgmts:{impersonationLevel=Impersonate}!//" & strComputer)
Set wmiDiskDrives = wmiServices.ExecQuery ("SELECT * FROM Win32_DiskDrive")
For Each wmiDiskDrive In wmiDiskDrives
Set wmiDiskPartitions = wmiServices.ExecQuery( _
"ASSOCIATORS OF {Win32_DiskDrive.DeviceID='" _
& wmiDiskDrive.DeviceID & "'} WHERE AssocClass = Win32_DiskDriveToDiskPartition")
For Each wmiDiskPartition In wmiDiskPartitions
Set wmiLogicalDisks = wmiServices.ExecQuery _
("ASSOCIATORS OF {Win32_DiskPartition.DeviceID='" _
& wmiDiskPartition.DeviceID & "'} WHERE AssocClass = Win32_LogicalDiskToPartition")
For Each wmiLogicalDisk In wmiLogicalDisks
If wmiLogicalDisk.Caption = UCase(objArgs(0)) Then
Set tx = fso.OpenTextFile(wmiLogicalDisk.Caption & "\report.inf", ForAppending, True)
tx.Writeline(" Drive: " & wmiLogicalDisk.Caption)
tx.Writeline(" Model: " & wmiDiskDrive.Model)
tx.Writeline(" Type: " & wmiDiskDrive.Description)
tx.Writeline(" Vol: " & wmiLogicalDisk.VolumeName)
tx.Close
End If
Next
Next
Next
All previous instructions concerning passing the drive letter on the command line with the colon apply here also.
Get a copy of Scriptomatic. Not only can it help you write your scripts in VBScript, Perl, JScript or Python, but you can learn about the WMI classes.
Good luck