Link to home
Start Free TrialLog in
Avatar of Bravo 7555
Bravo 7555Flag for United States of America

asked on

powershell script

Created a task to run a powershell script automatically. When i run the task the powershell runs, but it gets stuck at the prompt to hit R for Run once S for Suspend or ? Help.

How do I get the script to answer the prompt automatically with R each time?

Example of my script:  -file C:\Netwrix_Auditor_Add-on_for_RADIUS_Server\Netwrix_Auditor_Add-on_for_RADIUS_Server.ps1 -Radiushost 192.1.1.4
Avatar of becraig
becraig
Flag of United States of America image

I am guessing the script is what produces the prompt  ?

If so you can simply edit the script to produce the value of whatever variable the read-host / prompt populates or simply remove that piece.

Sharing the script would be a great starting point :)

Or just look for a spot where you see something like:
$somvariable = Read-Host "hit R for Run once S for Suspend or ? Help"
then replace with
$somevariable = "R"
Guess you need to set the execution policy, for example
Set-ExecutionPolicy RemoteSigned

Open in new window

Avatar of Bravo 7555

ASKER

here is the script
Good catch Sean, I completely missed the text of the error.
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
Please repost file
here it is posted again
ASKER CERTIFIED SOLUTION
Avatar of David Johnson, CD
David Johnson, CD
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
David,

In the following argument where do I add -executionpolicy bypass?

-file C:\Netwrix_Auditor_Add-on_for_RADIUS_Server\Netwrix_Auditor_Add-on_for_RADIUS_Server.ps1 -Radiushost 192.161.1.0