Const HKEY_CURRENT_USER = &H80000001 const HKEY_LOCAL_MACHINE = &H80000002 '========================================================================== set objWshShell = WScript.CreateObject("WScript.Shell") Set objWshNetwork = CreateObject("WScript.Network") Set oFS = Wscript.CreateObject("Scripting.FileSystemObject") Set objADSysInfo = CreateObject("ADSystemInfo") '========================================================================== objComputerName = objWshNetwork.ComputerName '========================================================================== Set objRegistry=GetObject("winmgmts:\\" & objComputerName & "\root\default:StdRegProv") LicKeyReg() If keyExists("MSLicensing", "SOFTWARE\Microsoft\", HKEY_LOCAL_MACHINE) Then MsgBox("Er is een probleem opgetreden bij het aanpassen van de licentiesleutel. Neem contact op met de Xwire Helpdesk.") Else MsgBox("Licentiesleutel is succesvol vervangen!") End If Function keyExists(strKeyName, strKeyPath, regCategory) retVal = false strComputer = "." Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_ strComputer & "\root\default:StdRegProv") oReg.EnumKey regCategory, strKeyPath, arrSubKeys For Each subkey In arrSubKeys If strKeyName = subkey Then retVal = true Exit For End If Next keyExists = retVal End Function Sub LicKeyReg() 'Verwijderen van MSLicensing Key DeleteSubkeys HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\MSLicensing" End Sub Sub DeleteSubkeys(HKEY_LOCAL_MACHINE, strKeyPath) 'Sub die nodig is voor het verwijderen van een Register Key (incl. onderliggende objecten) objRegistry.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubkeys If IsArray(arrSubkeys) Then For Each strSubkey In arrSubkeys DeleteSubkeys HKEY_LOCAL_MACHINE, strKeyPath & "\" & strSubkey Next End If objRegistry.DeleteKey HKEY_LOCAL_MACHINE, strKeyPath End Sub