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 YSnapin Command should look like this:
%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Bypass -File WindowsUpdate.ps1 Y YThat should work fine - and it seems snapins are pushed in order now, so I have this snapin named as 005.wsus for example.
-
@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…
-
@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.
-
@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.
-
@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?
-
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).
-
@Mentaloid +1 — thank you!
-
@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 YSnapin Command should look like this:
%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Bypass -File WindowsUpdate.ps1 Y YThat 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.
-
@Junkhacker wiki worthy
-
Snapin templates have been added to FOG Trunk (future 1.3.0 release). They are very very easy to use.