I’ve actually got it working now. I thought that recompiling HostNameChanger and changing the passkey was enough, but the out of bounds error is caused by the unpatched MOD_hostnamechanger.cs that is packed with 1.2.0. I cloned the latest version from git, changed the passkey and recompiled and now everything is working great. The error lies in the function at line 362 of MOD_HostnmeChanger.cs. The unpatched version only allows an array size of 6:
[CODE]if (arData.Length == 6)
{
strHostName = strHostResults.Remove(0, 5);
String strUseAD = arData[1];
String strD = arData[2];
String strOU = arData[3];
String strU = arData[4];
String strP = arData[5];
String strKey = arData[6];
if (strKey != null)
{
strKey = strKey.Trim();
if (strKey.StartsWith(“#Key=”))
{
strKey = strKey.Replace(“#Key=”, “”);
Process scriptProc = new Process();
scriptProc.StartInfo.FileName = @“cscript”;
scriptProc.StartInfo.Arguments =@“//B //Nologo c:\windows\system32\slmgr.vbs /ipk " + strKey;
scriptProc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
scriptProc.Start();
scriptProc.WaitForExit();
scriptProc.Close();
scriptProc.StartInfo.Arguments =@”//B //Nologo c:\windows\system32\slmgr.vbs /ato";
scriptProc.Start();
scriptProc.WaitForExit();
scriptProc.Close();
}
}[/CODE]
As apposed to the patched version from git that allows for an array size of 6 OR 7:
[CODE]if (arData.Length == 6 || arData.Length == 7)
{
strHostName = strHostResults.Remove(0, 5);
String strUseAD = arData[1];
String strD = arData[2];
String strOU = arData[3];
String strU = arData[4];
String strP = arData[5];
if(arData.Length == 7) {
String strKey = arData[6];
if (strKey != null)
{
strKey = strKey.Trim();
if (strKey.StartsWith("#Key="))
{
strKey = strKey.Replace("#Key=", "");
Process scriptProc = new Process();
scriptProc.StartInfo.FileName = @"cscript";
scriptProc.StartInfo.Arguments =@"//B //Nologo c:\windows\system32\slmgr.vbs /ipk " + strKey;
scriptProc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
scriptProc.Start();
scriptProc.WaitForExit();
scriptProc.Close();
scriptProc.StartInfo.Arguments =@"//B //Nologo c:\windows\system32\slmgr.vbs /ato";
scriptProc.Start();
scriptProc.WaitForExit();
scriptProc.Close();
}
}
}[/CODE]
Not really certain exactly what data the array is accepting, as I haven’t really had the time to scrutinize the code, but that seems to be the issue. Looks like it has something to do with a key value, but that doesn’t make sense because I’m not sending any key values. If anyone could explain what the data is that this array is being populated with that would be great. Otherwise I’ll come back and update when I’ve had the time to figure it out.
The version I used can be found here: [url]https://github.com/FOGProject/fogproject/tree/4b6a98a5a5ab552fbe066e062af857b33a17a15f/FOGService/src/FOG_HostNameChanger[/url]
The post on this forum that led me to this solution can be found here: [url]http://fogproject.org/forum/threads/active-directory-registration-not-working-windows-7-x64-client.11514/[/url]
Many thanks to Jbob for the info.