Script that runs in win-7 wont run in win-10
Hi Guys.
I have a powershell scriptthat runs fine in my win-7 image deployment. The script updates windows from our wsus server
after a domain join.
I am now creating a new image with win-10....(the latest creators update..1709) and the script wont run.
Says something about execution policy.
Any help would be great.
2 Comments
[ + ] Show comments
Answers (1)
Please log in to answer
Posted by:
airwolf
6 years ago
You need to call the script with the proper execution policy. That cannot be within the ps1 file itself... when you call the ps1 you have to already have bypassed it.
powershell.exe --ExecutionPolicy Bypass -File myscript.ps1
Comments:
-
I have done that. I have the bat file and the Ps1 all zipped into a zip file. The bat call the ps1 after executing the policy.. like this.......(without quotes)..
"powershell.exe -executionPolicy bypass -file windowsupdates.ps1 -UpdateTypes All".
Like I said it is the same file being run as a post install task in win7, in and works perfectly till date.
Win7 also disables script execution-policy by default and need to be enabled.
Any other update script I can try? - akmagnum 6 years ago
I believe you pointed me in the right direction last year to getting a post install task for wsus updates for my win7 image.........
"http://www.itninja.com/question/how-do-you-run-a-shell-script-in-k2000"
The point is that the "powershell.exe -executionPolicy bypass " is part of the old script.
So I shouldn't be getting execution-policy issues.
Just wanted to know if something has changed in win10.
FYI...I have enabled execution policy and then run the PS script...but still fails.
Thanks - akmagnum 6 years ago