Self-Solve Knowledge Search

Minimize Maximize
How to open UFT with “Run as administrator” option via script?
Title :
How to open UFT with “Run as administrator” option via script?
Document ID :
KM01417384
Product - Version:
unified functional testing ;
OS :
Updated :
Wed Feb 25 08:21:48 GMT 2015
Summary :
For different reasons it could be needed UFT to be started with “Run as administrator” option via script. How to do that?

For different reasons it could be needed Unified Functional Testing (UFT) to be started with “Run as administrator” option via script. For example the first connection to Application Lifecycle Management (ALM) should be done with administrator rights in order the ALM components to be downloaded and registered. Instead of doing it manually it could be done via script by starting UFT with "Run as administrator" option.

Solution

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.Launch
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"
      end if
qtApp.TDConnection.Disconnect     ‘disconnect from the ALM server
qtApp.Quit
set qtApp=nothing

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.