FOG HostnameChanger and Sysprep
-
So I’m running into a bit of an issue (sort of. I already have a workaround in place, but it would be nice to resolve it without the workaround).
I want to use FOG’s HostnameChange option to set the hostname of the computer before the computer boots up into the fresh image. And I believe this is working correctly.
However, in order to have a fully sysprepped, unattended image, unattend.xml requires that <ComputerName> is included. I currently have the computer automatically being named to ReplaceMe, and then FOG will typically shut down the computer and handle the renaming. However, if I could bypass that first restart find a way for unattend.xml to [I]not[/I] rename the computer (since it seems a little silly to go CorrectHostname -> ReplaceMe -> CorrectHostname again), that would be fantastic.
Has anyone run into this issue before?
I’ve tried a couple things already:
using <ComputerName></ComputerName> with nothing inbetween,
deleting the <ComputerName> line entirely (this causes the OOBE to ask for a hostname input),
and using <ComputerName>%computername%</ComputerName> (don’t do this one - Windows won’t even load, haha). -
I have found the same thing that you are have found
Early hostname changer does change the name as when we did an xp image without sysprep the name was the same as the one in the FOG Database.
for xp soe we ended up using wsname as we could not get sysprep to leave the computer name alone
This can be done in Windows 7 in the unattend.xml
[URL=‘http://technet.microsoft.com/en-us/library/cc732280(v=ws.10).aspx’][U][SIZE=3][COLOR=#0000ff][FONT=Calibri]http://technet.microsoft.com/en-us/library/cc732280(v=ws.10).aspx[/FONT][/COLOR][/SIZE][/U][/URL]You have to use the same syntax that is in the join secure example 2
Hope this helps
-
Ahhhh it takes %MACHINENAME% but not %COMPUTERNAME%? Bah.
Thanks for the link! It definitely helps, and I appreciate it.
-
Ah. This actually still isn’t working for me. Using this in the specialize pass (in the same place):
<ComputerName>%MACHINENAME%</ComputerName>
Do you know where the %MACHINENAME% variable is pulling its information from? I was under the impression it grabs the hostname currently in place, but I may have misunderstood.
-
Its in the registry
[url]http://www.windowstipspage.com/computername-registry-key/[/url]
my understanding is you also need to be using the the join secure in example 2
-
Ahhh that could be the problem I’m having. Idk if I’ll be able to get it working for my workplace (we have a bit of an odd situation with joining domains, where doing it through the unattend isn’t really an option – don’t ask, it’s complicated, haha). Maybe I’ll just add in some vbscript to query for that registry key and edit the unattend in the middle of the process to the current computer name.
Thanks for the link though! I always like to see where variables are coming from.
-
i actually have a solution for this, i’ve written code so that once fog has deployed the image to the machine it will change sysprep.inf for xp and unattend.xml to the hostname in the fog database and will add ad information from fog if set to join AD so when sysprep runs it already matches what has been set in FOG, this would solve all this but i don’t think the developers will go for it as it renders hostname change early un-needed and these features in FOGClient are no longer needed. if you want info on how to do this pm me as it’d be a lengthy tutorial/set of instructions to write. if a few people find it easy to implement then i’ll post an how to when i have the time to sit down and write one up…
-
Thanks for the info
my suggestion join secure did not work as it only works with WDS and Microsoft Deployment Tools. Its a shame with sysprep not being able to bypass comutername easily
I hope you work gets put in to a future release oF FOG as the Change Hostname Early feature does not work as intended
-
[quote=“Lee Rowlett, post: 7960, member: 28”]i actually have a solution for this, i’ve written code so that once fog has deployed the image to the machine it will change sysprep.inf for xp and unattend.xml to the hostname in the fog database and will add ad information from fog if set to join AD so when sysprep runs it already matches what has been set in FOG, this would solve all this but i don’t think the developers will go for it as it renders hostname change early un-needed and these features in FOGClient are no longer needed. if you want info on how to do this pm me as it’d be a lengthy tutorial/set of instructions to write. if a few people find it easy to implement then i’ll post an how to when i have the time to sit down and write one up…[/quote]
Haha, I would like to see that, actually. Although - if you’d like to keep it short and simple, could you tell me exactly where (and as a result, when) the code is being executed to open and alter unattend.xml? Are you running a MySQL query from the computer being imaged to grab the computer name? I could probably figure it out from there.
I actually had a system in place which would actually open up and edit the unattend file mid sysprep, by adding this registry key right before restarting, but after sysprepping -
“reg add HKLM\System\Setup /v CmdLine /t REG_SZ /d “cmd /c cscript //nologo C:\windows\system32\sysprep\editunattend.vbs” /f”Editunattend.vbs would essentially open up c:\Windows\Panther\unattend.xml, expand the environment variable for %COMPUTERNAME% that was in place, look for a string called “REPLACEME” in the unnattend file, and swap the strings and resave the file. Then it would kick off %WINDIR%\System32\oobe\windeploy.exe and sysprep would continue like normal.
Never got it to work though – it would work when there was a msgbox asking for the computer name as an input, so I’m thinking the %COMPUTERNAME% variable is either blank or unavailable when it tries running. Which is a shame.
-
See this post. Instructions are in there too now: [url]http://fogproject.org/forum/threads/hostname-change-joining-domain-before-sysprep-runs-xp-win7.3332/#post-7964[/url]
It changes it straight after fog has imaged the machine before the machine reboots into the os
Let me know how you get on
-
What are the benefits of this besides removing the 2 reboots to rename and join a computer to the domain. I’m pretty sure in FOG 0.33, the snap-in deployment will be quicker before the check-in time has been reduced to 30 seconds.
-
Just another alternative I guess…
-
Honestly, the reason I’m interested in it is - just because. Haha. The extra reboot certainly isn’t the end of the world. I would technically save a bit of time, but it’s more an excuse for me to learn more about how FOG works, and how PHP works, so I’m just playing with it when I have extra time (which isn’t very often). I don’t actually use snapins to deploy software - I have a lot of VBS that pulls info from active directory and deploys software from a networked drive based on that information.
Lee, I actually have been working on your post – I don’t have it in production yet, but I still have to fiddle around with buildroot. Although, I’m not sure I’ll need to - I think sed is actually included in whatever build of init.gz I have.