How could I programatically remove the Windows product key from registry in .NET (C# or VB.NET) to reproduce the same effect as when calling the Microsoft's legit slmgr.vbs script file with the /cpky argument?... so please do not misunderstand in my question "remove" for "uninstall". I just want to remove the bytes that correspond to the product key of Windows that is stored and encoded in the HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion: DigitalProductId registry value, so the product key still installed but it becomes inaccessible for 3rd party applications like ProduKey.
I tried to inspect the slmgr.vbs script file (stored at C:\Windows\System32) and it leads me to this method block:
Private Sub ClearPKeyFromRegistry()
Dim objService
On Error Resume Next
set objService = GetServiceObject("Version")
QuitIfError()
objService.ClearProductKeyFromRegistry()
QuitIfError()
LineOut GetResource("L_MsgClearedPKey")
End Sub
However I'm a little bit lost trying to find and to understand from where comes and what it does the GetServiceObject("Version") call, since it seems not to be a built-in VBS member neither it doesn't seem to be declared as any local member in the script file, and I didn't found any info regarding "GetServiceObject" on MSDN docs/VBS reference.
PS: Please note that I won't depend on the existance of the slmgr.vbs file to solve this issuea by simply calling that script file from C#...
UPDATE
I just scanned for the string "ClearProductKeyFromRegistry" in the dll files of the Windows filesystem, and found it in the sppwmi.dll file but unfortunately the function is not exported, then following with a simple research on Google it leads me to the ClearProductKeyFromRegistry method of the SoftwareLicensingService class on MSDN, but now I don't know how do I use that. I tried to find info about how to use a existing WMI provider in .NET, but all the info I see around the WWW is about how to implement/create a WMI provider.