sgufa Posted January 21, 2009 Posted January 21, 2009 Hi there. Is there a way to detect how many DISKS(not volumes) are installed in a machine, including disk name(like in device manager) and then detect partitions and their name? Please help me...
madflame991 Posted January 21, 2009 Posted January 21, 2009 Hi there. Is there a way to detect how many DISKS(not volumes) are installed in a machine, including disk name(like in device manager) and then detect partitions and their name? Please help me... search the help file next time... $var = DriveGetDrive( "all" ) If NOT @error Then MsgBox(4096,"", "Found " & $var[0] & " drives") For $i = 1 to $var[0] MsgBox(4096,"Drive " & $i, $var[$i]) Next EndIf Game Game Gadget! - read about indie games, gadgets, chiptunes and demoscenesAssembly-like language interpreter and custom machine emulatorSuper Mario Screen Mate - official website or autoit forum pageCogut - Puzzle Game + Editor like sokoban and others
sgufa Posted January 21, 2009 Author Posted January 21, 2009 search the help file next time...And you read better the questions...! I specified "NOT VOLUMES..."
weaponx Posted January 21, 2009 Posted January 21, 2009 $strComputer = "." $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\cimv2") $colDiskDrives = $objWMIService.ExecQuery("SELECT * FROM Win32_DiskDrive") For $objDrive In $colDiskDrives ConsoleWrite( "Physical Disk: " & $objDrive.Caption & " -- " & $objDrive.DeviceID & @CRLF) $strDeviceID = StringReplace($objDrive.DeviceID, "\", "\\") $colPartitions = $objWMIService.ExecQuery _ ("ASSOCIATORS OF {Win32_DiskDrive.DeviceID=""" & _ $strDeviceID & """} WHERE AssocClass = " & _ "Win32_DiskDriveToDiskPartition") For $objPartition In $colPartitions ConsoleWrite( "Disk Partition: " & $objPartition.DeviceID & @CRLF) $colLogicalDisks = $objWMIService.ExecQuery _ ("ASSOCIATORS OF {Win32_DiskPartition.DeviceID=""" & _ $objPartition.DeviceID & """} WHERE AssocClass = " & _ "Win32_LogicalDiskToPartition") For $objLogicalDisk In $colLogicalDisks ConsoleWrite( "Logical Disk: " & $objLogicalDisk.DeviceID & @CRLF) Next ConsoleWrite(@CRLF) Next ConsoleWrite(@CRLF) Nexthttp://www.microsoft.com/technet/scriptcen...05/hey0523.mspx
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now