Ask a Question

Running powershell file as admin from JS

SOLVED
TestQA1
Contributor

Running powershell file as admin from JS

Hi,

 

I have a below line in my javascript function in test complete, which runs the ps1 file.

WshShell.Run("powershell -file \"" + pathvar + "\\My Tests\\PickupTest.ps1\"")

Now the problem is that we have to manually run most files as Administrator to run the code in the files successfully. 

 

How can I run the ps1 file in my javascript as admin? It's blocking something really important in my test. 

 

Thank you

TestQA

1 REPLY 1
8Kit
Frequent Contributor

You can add Powershell as a TestApp and set RunAs to Admin: [TestComplete reference]

 

You can also add some lines of code to your PowerShell script to elevate your user privileges automatically (on UAC-enabled systems) - [examples]

cancel
Showing results for 
Search instead for 
Did you mean: