/build/static/layout/Breadcrumb_cap_w.png

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
  • Not to be rude, but did you do a Google search for "powershell execution policy"? - chucksteel 6 years ago
  • 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 - akmagnum 6 years ago

Answers (1)

Posted by: airwolf 6 years ago
Red Belt
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

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

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

Share

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ