Exit Code -1073418124 when applying applying KMS server rewrite action

I’ve identified and applied a fixlet to change an outdated KMS server in the Windows Registry. While some are returning completed, or fixed, others show exit code 0 or exit code -1073418124

None are actually reactivating Windows-- instead requiring an in-person visit to apply the change manually via CMD prompt script. Further we notice that the KMS server remains unchanged in these instances, still pointing to our old KMS server address.

Here is the fixlet:

Relevance
Show collapsed relevance
(
(
windows of operating system
)
AND
(
exists value “KeyManagementServiceName” of keys “HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform” of
(
x32 registries ; x64 registries
)
)
)
AND
(
/* not exists
(
it
whose
(
it contains “[kms.subdomain.domain.edu]”
)
of
(
if
exists key “HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform” of native registry
and
exists value “KeyManagementServiceName” of key “HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform” of native registry
then
value “KeyManagementServiceName” of key “HKEY_LOCAL_MACHINE\Software \Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform” of native registry as string as lowercase
else
nothing
)
)
*/ not exists value "KeyManagementServiceName"
whose
(
it as string as lowercase = “[kms.subdomain.domain.edu]”
)
of keys “HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform” of
(
x32 registries ; x64 registries
)
)

Show indented relevance
((windows of operating system) AND (exists value “KeyManagementServiceName” of keys “HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform” of (x32 registries ; x64 registries))) AND (/* not exists (it whose (it contains “kms.subdomain.domain.edu”) of (if exists key “HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform” of native registry and exists value “KeyManagementServiceName” of key “HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform” of native registry then value “KeyManagementServiceName” of key “HKEY_LOCAL_MACHINE\Software \Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform” of native registry as string as lowercase else nothing)) */ not exists value “KeyManagementServiceName” whose (it as string as lowercase = “kms.subdomain.domain.edu”) of keys “HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform” of (x32 registries ; x64 registries))
Action Script
Script Type BigFix Action Script

//x32 Operating System

if {not x64 of operating system and exists folder “c:\Program Files\Microsoft Office\Office14”}
waithidden cmd.exe /C cscript “c:\Program Files\Microsoft Office\Office14\OSPP.VBS” /sethst:kms.subdomain.domain.edu
waithidden cmd.exe /C cscript “c:\Program Files\Microsoft Office\Office14\OSPP.VBS” /act
endif

if {not x64 of operating system and exists folder “c:\Program Files\Microsoft Office\Office15” }
waithidden cmd.exe /C cscript “c:\Program Files\Microsoft Office\Office15\OSPP.VBS” /sethst:kms.subdomain.domain.edu
waithidden cmd.exe /C cscript “c:\Program Files\Microsoft Office\Office15\OSPP.VBS” /act
endif

//x64 Operating System
//64-bit Office
if {x64 of operating system and exists folder “c:\Program Files\Microsoft Office\Office14”}
waithidden cmd.exe /C cscript “C:\Program Files\Microsoft Office\Office14\OSPP.VBS” /sethst:kms.subdomain.domain.edu
waithidden cmd.exe /C cscript “C:\Program Files\Microsoft Office\Office14\OSPP.VBS” /act
endif

if {x64 of operating system and exists folder “c:\Program Files\Microsoft Office\Office15”}
waithidden cmd.exe /C cscript “C:\Program Files\Microsoft Office\Office15\OSPP.VBS” /sethst:kms.subdomain.domain.edu
waithidden cmd.exe /C cscript “C:\Program Files\Microsoft Office\Office15\OSPP.VBS” /act
endif

//32-bit Office
if {x64 of operating system and exists folder “C:\Program Files (x86)\Microsoft Office\Office14” }
waithidden cmd.exe /C cscript “C:\Program Files (x86)\Microsoft Office\Office14\OSPP.VBS” /sethst:kms.subdomain.domain.edu
waithidden cmd.exe /C cscript “C:\Program Files (x86)\Microsoft Office\Office14\OSPP.VBS” /act
endif

if {x64 of operating system and exists folder “C:\Program Files (x86)\Microsoft Office\Office15” }
waithidden cmd.exe /C cscript “C:\Program Files (x86)\Microsoft Office\Office15\OSPP.VBS” /sethst:kms.subdomain.domain.edu
waithidden cmd.exe /C cscript “C:\Program Files (x86)\Microsoft Office\Office15\OSPP.VBS” /act
endif

//Windows 7 and 8 and 2012
// Win Vista and 2008 require /ipk codes
if { (name of it contains “Win7” OR name of it contains “Win8” OR name of it contains “Win2012” OR name of it contains “Win2008R2” OR name of it contains “Win10”) of operating system }
waithidden cmd.exe /C cscript “c:\windows\system32\slmgr.vbs” -skms kms.subdomain.domain.edu:PORT
waithidden cmd.exe /C cscript “c:\windows\system32\slmgr.vbs” -ato
endif

//Windows 7 and 8 and 2012
// Win Vista and 2008 require /ipk codes
if { (name of it contains “Win7” OR name of it contains “Win8” OR name of it contains “Win2012” OR name of it contains “Win2008R2” OR name of it contains “Win10”) of operating system }
waithidden cmd.exe /C cscript “c:\windows\system32\slmgr.vbs” -skms kms.subdomain.domain.edu:PORT
waithidden cmd.exe /C cscript “c:\windows\system32\slmgr.vbs” -ato
endif

=======

I also ran a custom Task to simply run the last portion:
if { (name of it contains “Win7” OR name of it contains “Win8” OR name of it contains “Win2012” OR name of it contains “Win2008R2” OR name of it contains “Win10”) of operating system }
waithidden cmd.exe /C cscript “c:\windows\system32\slmgr.vbs” -skms kms.subdomain.domain.edu:PORT
waithidden cmd.exe /C cscript “c:\windows\system32\slmgr.vbs” -ato
endif

Again, Exit Code -1073418124 : KMS Server unchanged.

Any ideas what might be going on here?

1 Like

The 32-bit redirection is probably impacting you. I’ll try to post more details when I have a computer available, but unless you use action uses wow64 redirection false your commanda are all running in 32-bit mode, and you need to use native program files folder, program files x32 folder, or program files x64 folder in your relevance checks and actionscript substitutions.

The Relevance has to check several things, including both OS, Office, and every GUID under the Office registry key (I’ve seen a few cases where the top-level SoftwareProtectionPlatform for Office is correct, but a sub-GUID is not)

(if version of operating system >= "6" as version then not exists (value "KeyManagementServiceName" of key "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" of native registry) whose (it as string="kms.subdomain.domain.edu") else false) OR /* There is at least one matching entry, and there are no mismatched entries for Office actionvation if Office is present*/ (if exists keys ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\OfficeSoftwareProtectionPlatform") of (x32 registries; x64 registries) then (exists it whose (it as string != "kms.subdomain.domain.edu") of values "KeyManagementServiceName" of (keys of keys of it; it) of keys ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\OfficeSoftwareProtectionPlatform") of (x32 registries; x64 registries) OR not exists it whose (it as string = "kms.subdomain.domain.edu") of values "KeyManagementServiceName" of (keys of keys of it; it) of keys ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\OfficeSoftwareProtectionPlatform") of (x32 registries; x64 registries) ) else false) 

For the Action, I use

action uses wow64 redirection false

// Enter your action script here
parameter "KMS_Host"="kms.subdomain.domain.edu"


delete "__appendfile"
// All Windows Vista or Higher hosts should use OS KMS script slmgr.vbs
if {version of operating system >= "6" as version}
	appendfile cscript //nologo "{pathname of native system folder}\slmgr.vbs" /skms {parameter "KMS_Host" of action as string}
endif

// Any Windows box with Office "ospp.vbs" script should use Office KMS script ospp.vbs
//  This *could* be older XP/2003 systems as well, if they have Office 2010
if {exists files "ospp.vbs" of folders (values "Path" of keys "Common\InstallRoot" of keys of keys ("Microsoft\Office") of keys ("HKLM\Software";"HKLM\Software\Wow6432Node") of native registry as string)}
	// Change Office KMS Host config
	appendfile cscript //nologo "{pathnames of files "ospp.vbs" of folders (values "Path" of keys "Common\InstallRoot" of keys of keys ("Microsoft\Office") of keys ("HKLM\Software";"HKLM\Software\Wow6432Node") of native registry as string)}" /sethst:{parameter "KMS_Host" of action as string}
endif

   // Correct all existing Office reg keys to prevent a false-positive detection in the future for Office installations that are no longer active
    appendfile {concatenation "%0d%0a" of ("reg add %22" & it & "%22 /v %22KeyManagementServiceName%22 /t REG_SZ /d %22" & parameter "KMS_Host" of action as string & "%22 /F") of (pathnames of parent keys of it whose (it as string != parameter "KMS_Host" of action as string) of values "KeyManagementServiceName" of  keys of keys of keys  ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\OfficeSoftwareProtectionPlatform") of (x32 registries; x64 registries))}

// All Windows Vista or Higher hosts should try to activate after applying the new KMS hostname
if {version of operating system >= "6" as version}
	appendfile cscript //nologo "{pathname of native system folder}\slmgr.vbs" /ato > "{pathname of windows folder}\temp\slmgr.out" 2>&1
endif


delete "SetKMSInfo.cmd"
move "__appendfile" "SetKMSInfo.cmd"
waithidden cmd /c SetKMSInfo.cmd
1 Like

Me: Mouth wide open in amazement! Worked like a charm; Thank you very much @JasonWalker