What function can be used to get all local drives on the machines? ie. drive A, drive B or drive C
I did a search on the Test complete help file and couldn't find it. any suggestions?
The information you need can be obtained using methods and classes of the WMI OLE object.
A detailed description of WMI and its classes can be found in MSDN:
You can use the following script to get the information:
PostDrivesInfo("< computer name >")
Dim ObjectsList, CurrentObject, FolderID
FolderID = Log.CreateFolder("Logical Disks")
Set WMIService = GetObject("winmgmts:\\" & ComputerName & "\root\cimv2")
' Selects all hard drives
Set ObjectsList = WMIService.ExecQuery("Select * from Win32_LogicalDisk")
For Each CurrentObject in ObjectsList
FolderID = Log.CreateFolder(CurrentObject.Name)
Log.Message "Label: " & CurrentObject.VolumeName
Log.Message "Size (MB): " & CurrentObject.Size / 1024^2
Log.Message "FreeSpace (MB): " & CurrentObject.FreeSpace / 1024^2
Please visit the following MSDN page for more information about the Win32_LogicalDisk class:
Thanks for the scripts! I will try it. Acutally, my test scripts with a project are stored in different drives on different machines. ie store in drive C in machine1, drive D in machine2. That's why I need to find a solution that Test complete can run the test scripts on a particular drive on a machine. It means that I can run the tests with the same project on different machines.
I tried to use the LocalVariable panel but it didn't work well because the same project is used on all test machines. I can't hardcode to set a variable 'LocalDrive' to 'D' on the project as it won't work on the machine. any suggestions?
You can use the Project.Path, ProjectSuite.Path and Utilities.ExpandFileName methods to retrieve the paths.
Please see the corresponding TestComplete help topics for more information.