-1

I wrote this VBS that shows Windows key:

Set WshShell = CreateObject("WScript.Shell")
MsgBox ConvertToKey(WshShell.RegRead("HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\DigitalProductId"))

Function ConvertToKey(Key)
Const KeyOffset = 52
i = 28
Chars = "BCDFGHJKMPQRTVWXY2346789"
Do
Cur = 0
x = 14
Do
Cur = Cur * 256
Cur = Key(x + KeyOffset) + Cur
Key(x + KeyOffset) = (Cur \ 24) And 255
Cur = Cur Mod 24
x = x -1
Loop While x >= 0
i = i -1
KeyOutput = Mid(Chars, Cur + 1, 1) & KeyOutput
If (((29 - i) Mod 6) = 0) And (i <> -1) Then
i = i -1
KeyOutput = "-" & KeyOutput
End If
Loop While i >= 0
ConvertToKey = KeyOutput
End Function

I need to run it on some other computers on our domain remotely and have key echoed back to me. I'm domain administrator. How can I do it?

3
  • Nothing, otherwise I wouldn't be asking would I?
    – Jack
    Sep 4 '15 at 12:47
  • 1
    I don't believe this to be a real question, because as you say, you have tried nothing. Here is a question from our sister site has a question with an aswer that should answer your question. Here is a near duplicate.
    – Ramhound
    Sep 4 '15 at 12:51
  • 1
    @Jack - You're the domain administrator and you haven't tried any way of doing this first.... That's pretty lazy buddy. Why not try running it as a logon script for those computers?
    – Joe Taylor
    Sep 4 '15 at 13:01
1

I need to run it on some other computers on our domain remotely

Execute the .vbs file on the remote machine using cscript:

psexec.exe \\computer -u user -p pass c:\windows\system32\cscript.exe script.vbs

Further reading

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.