If you know the administrator password of a system that you are authorized to use, you can use this function to reboot it for some automation needs. please do not try this on systems that you are not authorized to use. I have shown only the function definition here. You can use this in a QTP function library.
Continue reading
Tag Archives: wmi
Executing a command on a remote windows system using WMI
3Usually we use psexec tool from sysinternals to execute any program on a remote system. There is another way to execute a command on a remote windows system via WMI (Windows Management Instrumentation). This function would be beneficial to QTP automators because its a vbscript function and can be used in their function libraries (after some modifications). All you have to do is call this function with the target system name, username, password and the command to execute. The output would be the process if of the process that was initated on the target system. Have fun…
Determine the mapped drives on QTP Client
0You can use WMI Class Win32_LogicalDisk to find that out. With this class not only can we determine which drives are mapped to network shares, but we can also determine which network shares they map to. Please note that the DriveType equal to 4 represents a mapped network drive. For more details about Drivetype values, refer the WMI SDK. The WMI query returns a collection of mapped drives. DeviceID, which returns the drive letter for the drive; and ProviderName, which returns the network share the drive is mapped to .
Continue reading
Determine the current time on a remote system
3At times you may have to determine the time on a remote system to be able to schedule some job on that system automatically. I will talk about how to schedule a job on a remote system in a seperate post. We could use the help of WMI protocol in determining the target system time.
Here’s the function. Have fun !
Check status of a windows service on a remote system using WMI
1In the automation world, you may be required to check whether the product that you wanted to test is installed and the application service is running properly. You could use the below code to accomplish that. You could add this to a function library and associate it with QTP test. Then call the function with appropriate test parameters. For example :