Old 22nd June 2021, 17:59   #1
shekara
Junior Member
 
Join Date: Oct 2020
Posts: 33
run powershell script from nsis

I am running into an issue when I try to execute a powershell script through nsis. I get the error code 196608. when I google on this, they say it is because I have set execution policy as bypass and not RemoteSigned. the solution google recommends is to set execution policy as RemoteSigned. when I set this in nsis, it still throws an error. I have tried this.
#ExecWait "powershell.exe -ExecutionPolicy RemoteSigned -WindowStyle Hidden -File '$TEMP\PS.ps1'" $0
#ExecWait 'powershell.exe "& "$TEMP\PS.ps1"' $0
#ExecWait "powershell -inputformat none -ExecutionPolicy RemoteSigned -File '$TEMP\PS.ps1'" $0

I cannot set RemoteSigned as it is a req. any help like always is appriciated
shekara is offline   Reply With Quote
Old 22nd June 2021, 21:04   #2
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,420
Does it happen with all powershell scripts?

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 23rd June 2021, 01:54   #3
shekara
Junior Member
 
Join Date: Oct 2020
Posts: 33
yes... i tried with another one and same issues
shekara is offline   Reply With Quote
Old 23rd June 2021, 10:27   #4
stass
Senior Member
 
Join Date: Nov 2012
Posts: 166
With the specified syntax (Space, after double quotes !) , the script is performed normally :

code:
ClearErrors
nsExec::ExecToStack 'powershell -inputformat none -ExecutionPolicy RemoteSigned -File ""$EXEDIR\MyPs.ps1"" '
Pop $0

stass is offline   Reply With Quote
Old 1st July 2021, 07:23   #5
shekara
Junior Member
 
Join Date: Oct 2020
Posts: 33
thank you
shekara is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump