TestQA1
3 years agoFrequent 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
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]