The following script provides example how to run UFT with “Run as administrator” option and then to connect to an ALM server.
set shellObj = CreateObject("Shell.Application")
shellObj.ShellExecute "full path to the UFT.exe", "" , "", "runas", 1 ‘That line will start UFT with “Run as administrator” option
WScript.sleep 30000 ‘wait till UFT is launched
set qtApp = CreateObject("QuickTest.Application")
qtApp.Visible = True
qtApp.TDConnection.Connect "http://server name:8080/qcbin", "domain", "project name", "user name", "password", False ‘Connect to an ALM server
If qtApp.TDConnection.IsConnected then ‘perform a simple check if the connection is successful
msgbox "Connection successful"
qtApp.TDConnection.Disconnect ‘disconnect from the ALM server
DISCLAIMER OF WARRANTY
The example software is experimental and is provided as a courtesy, free of charge, "AS-IS" by Hewlett-Packard Development Company, L.P. ("HP"). HP shall have no obligation to maintain or support this software. HP MAKES NO EXPRESS OR IMPLIED WARRANTY OF ANY KIND REGARDING THIS SOFTWARE. HP SHALL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES, WHETHER BASED ON CONTRACT, TORT OR ANY OTHER LEGAL THEORY, IN CONNECTION WITH OR ARISING OUT OF THE FURNISHING, PERFORMANCE OR USE OF THIS SOFTWARE.