Update Registry when FOG client changes Host.
-
I’m interested in working on the FOG client a bit. We use Novell in our network and we have to update the registry to reflect the host name of the machine in order for our auto login scripts to work.
I’d like to know how to add a simple registry command to the FOG client so when it updates the host name it updates the registry with the same host data. Ideas are welcome!!!
Thanks for your help!
-
Hi,
another suggestion: why not writing a simple script for each machine (deployed by whatever)
that checks the actual real hostname against that one in the registry?If you need that in place of a shutdown because the registry change is only confirmed by a restart
then look around howto execute something before a shutdown.Greetz X23
-
Thanks for the idea x23 I’ll give this a shot, I’ll see what I can’t come up with.
-
Hi,
in case of windows:
actual computername:
[CODE]HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\ComputerName\ComputerName[/CODE]
env variable:
[CODE]hostname[/CODE]
or
[CODE]%COMPUTERNAME%[/CODE]doing with the registry…
[QUOTE]REG QUERY /?
REG ADD /?
REG DELETE /?
REG COPY /?
REG SAVE /?
REG RESTORE /
REG LOAD /?
REG UNLOAD /?
REG COMPARE /
REG EXPORT /?
REG IMPORT /?[/QUOTE][CODE]@echo off
set newhname=%COMPUTERNAME%
FOR /F “tokens=3 skip=2” %%i IN (‘REG QUERY “HKLM\System\CurrentControlSet\Control\ComputerName\Computername” /v ComputerName’) DO SET oldhname=%%i
if %newhname% EQU %oldhname% goto donothing
REG ADD HKLM\System\CurrentControlSet\Control\ComputerName /v ComputerName /t REG_SZ /d %newhname%
:donothing[/CODE]Greetz X23
-
okay, so I found the section in MOD_HostNameChanger.cs in the folder /usr/src/fog_0.32/FOG Service/src/FOG_HostNameChanger
I have added these two lines
regKey = Registry.LocalMachine.OpenSubKey(@“SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon”, true);
regKey.SetValue(“AltDefaultDomainName”, newname);
regKey = Registry.LocalMachine.OpenSubKey(@“SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon”, true);
regKey.SetValue(“DefaultDomainName”, newname);to the class
[code]
private void doDefaultMode( string newname)
{
RegistryKey regKey = null;
log(MOD_NAME, “Using default fog method.”);
regKey = Registry.LocalMachine.OpenSubKey(@“SYSTEM\CurrentControlSet\Services\Tcpip\Parameters”, true);
regKey.SetValue(“NV Hostname”, newname);
regKey = Registry.LocalMachine.OpenSubKey(@“SYSTEM\CurrentControlSet\Control\ComputerName\ActiveComputerName”, true);
regKey.SetValue(“ComputerName”, newname);
regKey = Registry.LocalMachine.OpenSubKey(@“SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName”, true);
regKey.SetValue(“ComputerName”, newname);
regKey = Registry.LocalMachine.OpenSubKey(@“SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon”, true);
[/code]being the registry values I am wanting to change are in [B]HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\DefaultDomainName[/B] and [B]HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\AltDefaultDomainName[/B]
and I want to populate it with the same information being supplied in the rest of the registry keys.Do I need to compile this and push it, or is saving the configurations going to be good enough?
I already built my image, do I need to update the fog client on my images and push it out again?
Sorry not done anything like this before don’t want to break anything and I want it to work