When do assigned snapins run relative to binding?
-
Hi,
I have a snaping (batch script) that I want to run on my machines right after imaging, but it needs to run after the machine is bound to AD. What is the order of operations with regard to namechange, binding, and snapins? Also there are Group Policies running on the machine after the first boot from binding, how does that play in with snapins? -
@astrugatch I think the only way you can make absolutely sure this is working reliably in your environment is to add a check to your snapin batch file!
-
@Sebastian-Roth
By check do you mean to check for binding? The issue then is that it’s not going to try to run again if it wasn’t bound at the time; as the snapin will have technically exited fine having run it’s check and done nothing. Unless there is a way for a batch file to exit and re-arm the snapin to be executed at a later time. If I can determine the order I can work out the timing of when each thing lands. -
@astrugatch I have to say that I am not the one who developed the fog-client software in the first place and so I am still working my way through this and don’t know it all top to bottom.
What is the order of operations with regard to namechange, binding, and snapins?
First comes the module called HostnameChanger which checks to see if the hostname equals the one given within the FOG host settings and if the host is joined to the domain. If one or the other is not ok it renames and/or joins and schedules a reboot for the computer.
Now with the snapin module being executed next it might happen that the snapin is trying to execute while Windows is in the process of handling the system reboot. This was discussed here before: https://forums.fogproject.org/topic/7550/fog-client-snapins-run-after-computer-rename-domain-join
While I have not found a commit on github that addresses this issue directly I see a couple of commits around that date working on the timing of reboot stuff in the code. So I suppose he tried to get this right. Have you actually tried running snapins right after a deploy? Do they fail? Please provide a full fog.log from that client and I’ll look into it then!
Just one note to myself for later debugging. This might be related and could turn out helpful: https://github.com/FOGProject/zazzles/commit/3643e7c9592662ed7061c6096a73948f7cba1a40
This forum topic seems to be related as well.
-
@astrugatch While debugging another fog-client issue on host rename I found this in my log file:
------------------------------------------------------------------------------ --------------------------------HostnameChanger------------------------------- ------------------------------------------------------------------------------ 8/27/2019 3:07 AM Client-Info Client Version: 0.11.16 8/27/2019 3:07 AM Client-Info Client OS: Windows 8/27/2019 3:07 AM Client-Info Server Version: 1.5.7 8/27/2019 3:07 AM Middleware::Response Success 8/27/2019 3:07 AM HostnameChanger Checking Hostname 8/27/2019 3:07 AM HostnameChanger Renaming host to Newhostname 8/27/2019 3:07 AM HostnameChanger Renaming host inside existing domain binding 8/27/2019 3:07 AM HostnameChanger Success, code = 0 8/27/2019 3:07 AM Power Creating shutdown command in 60 seconds 8/27/2019 3:07 AM Bus Emmiting message on channel: Power ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ ---------------------------------SnapinClient--------------------------------- ------------------------------------------------------------------------------ 8/27/2019 3:07 AM Client-Info Client Version: 0.11.16 8/27/2019 3:07 AM Client-Info Client OS: Windows 8/27/2019 3:07 AM Client-Info Server Version: 1.5.7 8/27/2019 3:07 AM Middleware::Response Success 8/27/2019 3:07 AM SnapinClient A power operation is pending, aborting module ------------------------------------------------------------------------------
So from my point of view it shouldn’t try to run snapins while a reboot from the HostnameChanger (or any other) module is scheduled.
-
I finally got to test this today. It appears to be
Hostname/bind
Reboot
Waits for a complete reboot (this is good for be because this is where my GPO installs happens) then after the boot process completes the snapin runs. In this case running a script to install AutoCAD. -
@astrugatch Good to hear! Thanks.