Page 1 of 1

Running powershell script in commandline

Posted: Thu Oct 07, 2021 1:44 pm
by KimVW
I might have a silly question here...

When I manually start cmd and run my powershell script to get all installed office apps then the script runs fine and my result is shown.

When I do exactly the same process via Ranorex it fails every time!

What am I missing here, what am I doing wrong?
pwsincommandline.png
2021-10-07_14-43-45.png
tnx!

Re: Running powershell script in commandline

Posted: Thu Oct 07, 2021 2:06 pm
by odklizec
Hi,

Unfortunately, it's hard to tell what's wrong, without seeing the ps1 file. Have you tried to create a batch file, which will execute the powershell commands (instead of typing the commands to cmd window)? Also, are you running the test/Ranorex Studio as admin or non-admin?

Re: Running powershell script in commandline

Posted: Tue Jan 24, 2023 3:30 pm
by KimVW
Instead of starting the script with the Action 'run application' I decided to start up my Windows explorer and simply double click the file there... it's a little bit of more steps, but it's working fine

Re: Running powershell script in commandline

Posted: Mon Feb 06, 2023 4:29 pm
by Baxter
this drove me nuts for a while until I found this in the weeds of stackoverflow:

https://stackoverflow.com/questions/131 ... om-c-sharp
Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Unrestricted