Hi people,

I am trying to run a shell script to install windows updates

as a post install task in  the k2000.

Basically how do you run powershell scripts in version 3.7 and upis what I want to know..

I read online that you should save the code below as a batch file.......

xcopy “%~dp0*.*” c:\windows\temp\ /s /y /e
powershell -noprofile -command Set-ExecutionPolicy bypass LocalMachine
powershell -file C:\windows\temp\myPowershellScript.ps1


and then zip it up with your shell script and upload to the k2., then call the

batch file in the post install task.

Not working for me....... SO HOW DO I RUN ANY POWERSHELL SCRIPT

IN K2000??

Thanks guys.

Answer Summary:
Cancel
0 Comments   [ + ] Show Comments

Comments

Please log in to comment

Answer Chosen by the Author

0
I'm using the PowerShell script from here:
https://gallery.technet.microsoft.com/scriptcenter/Simple-Windows-Update-Tool-3a505873

This is my installupdates.bat
powershell.exe -executionPolicy bypass -file WindowsUpdate.ps1 -UpdateTypes All

I put the two files in a zip then created a new Post-Install task as an application (you can't upload attachments to a script). For the parameter enter installupdates.bat.

Answered 05/04/2016 by: chucksteel
Red Belt

  • Thanks chucksteel. Will try it.
  • Hey chuck...
    Kace gives me the same error that it was giving me
    with other scripts I tried to run from a zip file...
    error is...

    windows cannot find 'installupdates.bat'. Make sure you type the name correctly, and then try again.

    Any ideas??
    Thanks
    • When you created the zip file did you right click on the batch file and the other file or did you have them in a folder? If you have them in a folder and you compress that folder then they will be inside that folder when uncompressed. You can check the \\k2000\peinst share (you'll need the SAMBA password) to see what the files look like. Look in Applications, the ID of the post-install task, then contents.
      • Ok , I think I have a problem.
        I don't have a peinst share in my \\k2000.
        I have a "drivers" folder, a "drivers_postinstall" folder, and a "restore"folder.
        Why is it I don't have one??
        I don't think I deleted it . I wouldn't do that.
        How can I get it back?
        Thanks!
      • The peinst and petemp shares are hidden so if you just browse to the k2000 they won't show, but they are there.
  • Thanks Chuck. All sorted.
Please log in to comment

Answers

Answer this question or Comment on this question for clarity

Share