• Recent
    • Unsolved
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    FOG + Powershell (WinUpdate) Question

    Scheduled Pinned Locked Moved
    Windows Problems
    6
    22
    8.1k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M
      Mentaloid
      last edited by

      I used a snapin for tasks like this - because I found fog service was renaming and rebooting before any tasks that took more than a few seconds in my setupcomplete.bat. Any snapins are installed after domain join, at least by my testing.

      Snapin Run With : %SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe
      Snapin run with argument : -ExecutionPolicy Bypass -File
      Snapin File : WindowsUpdate.ps1
      Snapin Args: Y Y

      Snapin Command should look like this:
      %SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Bypass -File WindowsUpdate.ps1 Y Y

      That should work fine - and it seems snapins are pushed in order now, so I have this snapin named as 005.wsus for example.

      R 1 Reply Last reply Reply Quote 0
      • R
        RLane @Mentaloid
        last edited by

        @Mentaloid That’s actually a pretty nifty idea… let me upload a new image without the script running from my batch file. The more I use FOG, the more I start to realize it’s designed to make life easy…

        Tom ElliottT 1 Reply Last reply Reply Quote 1
        • Tom ElliottT
          Tom Elliott @RLane
          last edited by

          @RLane Why not just disable the service before sysprep is run. In the Setupcomplete.cmd script at the end of the script re-enable the service.

          Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG! Get in contact with me (chat bubble in the top right corner) if you want to join in.

          Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

          Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

          R 1 Reply Last reply Reply Quote 0
          • R
            RLane @Tom Elliott
            last edited by

            @Tom-Elliott The FOG service? Didn’t think of that, either. While we’re on this topic - does anybody else have a more effective way of updating Windows via scripting? I know a lot of things I did on 7 I can no longer do now.

            1 Reply Last reply Reply Quote 0
            • Wayne WorkmanW
              Wayne Workman @Joe Schmitt
              last edited by

              @Jbob said in FOG + Powershell (WinUpdate) Question:

              @RLane , could you just disable the FOG service in the image, and then have your powershell script re-enable it once finished?

              Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG!
              Daily Clean Installation Results:
              https://fogtesting.fogproject.us/
              FOG Reporting:
              https://fog-external-reporting-results.fogproject.us/

              M 1 Reply Last reply Reply Quote 0
              • M
                Mentaloid @Wayne Workman
                last edited by Mentaloid

                @Wayne-Workman

                Yep - I ended up doing that as well, but things I noted:

                Some stuff the AD join and hostname change should be completed first (wsus server and policies and proxy via AD and group policies) - and without the service running, that won’t be completed. Enabling the service at the send of the setupcomplete.cmd means the rename and join hasn’t been completed. Doing it at the beginning, and then running other tasks mean that it will reboot while completing the other tasks.

                This is what I’ve done to get the best of both…

                example sysprep.cmd

                sc stop FOGService
                sc config FOGService start=disabled
                sc stop FOGService
                
                copy \\fog\Deploy\W10\unattend.xml %systemroot%\System32\sysprep\unattend.xml
                mkdir %systemroot%\setup\scripts
                copy \\fog\Deploy\W10\setupcomplete.cmd %systemroot%\setup\scripts\setupcomplete.cmd
                
                net use * /del
                del c:\users\administrator\desktop\*.lnk
                c:
                cd \windows\system32\sysprep
                c:\windows\System32\sysprep\sysprep.exe /quiet /oobe /generalize /shutdown /unattend:unattend.xml
                

                and my setupcomplete.cmd

                @echo off
                del /Q /F c:\windows\system32\sysprep\unattend.xml
                del /Q /F c:\windows\panther\unattend.xml
                net user Administrator /active:yes
                sc config FOGService start=auto
                sc start FOGService
                net use * /del
                exit
                

                Then the snapins run after fog service renames and joins the domain.

                The reason I use snapins for everything else - because I like my setupcomplete to be simple and fast - anything I want beyond the basics, I can choose to implement or not without changing the setupcomplete; just add the snapins (which for @RLane, would be the windowsupdate snapin).

                R 1 Reply Last reply Reply Quote 1
                • R
                  RLane @Mentaloid
                  last edited by

                  @Mentaloid +1 — thank you!

                  1 Reply Last reply Reply Quote 0
                  • JunkhackerJ
                    Junkhacker Developer
                    last edited by

                    @Mentaloid said in FOG + Powershell (WinUpdate) Question:

                    I used a snapin for tasks like this - because I found fog service was renaming and rebooting before any tasks that took more than a few seconds in my setupcomplete.bat. Any snapins are installed after domain join, at least by my testing.

                    Snapin Run With : %SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe
                    Snapin run with argument : -ExecutionPolicy Bypass -File
                    Snapin File : WindowsUpdate.ps1
                    Snapin Args: Y Y

                    Snapin Command should look like this:
                    %SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Bypass -File WindowsUpdate.ps1 Y Y

                    That should work fine - and it seems snapins are pushed in order now, so I have this snapin named as 005.wsus for example.

                    just wanted to post my results from getting a powershell script to run with the legacy client. i had to use the following settings:

                    Snapin Run With : powershell.exe
                    Snapin run with argument : -ExecutionPolicy Bypass -command "& ’
                    Snapin File : script.ps1
                    Snapin Args: ’ "

                    the -command "& ’ and ’ " will wrap the script with it’s full path in quotes, allowing for spaces in the path.

                    signature:
                    Junkhacker
                    We are here to help you. If you are unresponsive to our questions, don't expect us to be responsive to yours.

                    Wayne WorkmanW 1 Reply Last reply Reply Quote 1
                    • Wayne WorkmanW
                      Wayne Workman @Junkhacker
                      last edited by Wayne Workman

                      @Junkhacker wiki worthy

                      Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG!
                      Daily Clean Installation Results:
                      https://fogtesting.fogproject.us/
                      FOG Reporting:
                      https://fog-external-reporting-results.fogproject.us/

                      1 Reply Last reply Reply Quote 0
                      • Wayne WorkmanW
                        Wayne Workman
                        last edited by

                        Snapin templates have been added to FOG Trunk (future 1.3.0 release). They are very very easy to use.

                        Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG!
                        Daily Clean Installation Results:
                        https://fogtesting.fogproject.us/
                        FOG Reporting:
                        https://fog-external-reporting-results.fogproject.us/

                        1 Reply Last reply Reply Quote 0
                        • 1
                        • 2
                        • 2 / 2
                        • First post
                          Last post

                        223

                        Online

                        12.0k

                        Users

                        17.3k

                        Topics

                        155.2k

                        Posts
                        Copyright © 2012-2024 FOG Project