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

Comments

  • Not to be rude, but did you do a Google search for "powershell execution policy"?
  • What I meant to say chuck..... is that my "Windows updates" powershell script.... that worked in win7... doesn't seem to work in win10.
    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
Please log in to comment

Answers

1
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
Answered 10/19/2017 by: airwolf
Tenth Degree Black Belt

  • 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?
Please log in to comment
Answer this question or Comment on this question for clarity

Share