fork(1) download
  1. Const HKEY_LOCAL_MACHINE = &H80000002
  2.  
  3. WinKey = GetWinKey
  4. strComputer="."
  5.  
  6.  
  7. OfficeKeys = GetOfficeKey("10.0") & GetOfficeKey("11.0") & GetOfficeKey("12.0") & GetOfficeKey("14.0") & GetOfficeKey("15.0")
  8.  
  9. If Msgbox(WinKey & vbnewline & vbnewline & OfficeKeys & vbnewline & "Save All Keys to ProductKeys.txt?", vbyesno, "GetProductKeys.VBS by Foolish IT") = vbyes then
  10. Set objFSO = CreateObject("Scripting.FileSystemObject")
  11. Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
  12. Set colSystem = objWMIService.ExecQuery ("Select * from Win32_ComputerSystem")
  13. 'Set objTextFile1 = objFSO.CreateTextFile("ProductKeys.txt" ,True)
  14. Set objTextFile = objFSO.OpenTextFile("_ProductKeys.txt",8)
  15. For Each objComputer in colSystem
  16. objTextFile.WriteLine "Nazwa: " & objComputer.Name
  17. Next
  18. objTextFile.WriteLine ""
  19. objTextFile.WriteLine WinKey & vbnewline & vbnewline & OfficeKeys
  20. objTextFile.WriteLine "---------------------------------------------------------------------------------------------------------------------------------"
  21. objTextFile.Close
  22. end if
  23.  
  24. Function GetOfficeKey(sVer)
  25. On Error Resume Next
  26. Dim arrSubKeys
  27. Set wshShell = WScript.CreateObject( "WScript.Shell" )
  28. sBit = wshShell.ExpandEnvironmentStrings("%ProgramFiles(x86)%")
  29. if sBit <> "%ProgramFiles(x86)%" then
  30. sBit = "Software\wow6432node"
  31. else
  32. sBit = "Software"
  33. end if
  34. Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")
  35. objReg.EnumKey HKEY_LOCAL_MACHINE, sBit & "\Microsoft\Office\" & sVer & "\Registration", arrSubKeys
  36. Set objReg = Nothing
  37. if IsNull(arrSubKeys) = False then
  38. For Each Subkey in arrSubKeys
  39. if lenb(other) < 1 then other = wshshell.RegRead("HKLM\" & sBit & "\Microsoft\Office\" & sVer & "\Registration\" & SubKey & "\ProductName")
  40. if ucase(right(SubKey, 7)) = "0FF1CE}" then
  41. Set wshshell = CreateObject("WScript.Shell")
  42. key = ConvertToKey(wshshell.RegRead("HKLM\" & sBit & "\Microsoft\Office\" & sVer & "\Registration\" & SubKey & "\DigitalProductID"))
  43. oem = ucase(mid(wshshell.RegRead("HKLM\" & sBit & "\Microsoft\Office\" & sVer & "\Registration\" & SubKey & "\ProductID"), 7, 3))
  44. edition = wshshell.RegRead("HKLM\" & sBit & "\Microsoft\Office\" & sVer & "\Registration\" & SubKey & "\ProductName")
  45. if err.number <> 0 then
  46. edition = other
  47. err.clear
  48. end if
  49. Set wshshell = Nothing
  50. if oem <> "OEM" then oem = "Retail"
  51. if lenb(final) > 1 then
  52. final = final & vbnewline & final
  53. else
  54. final = edition & " " & oem & ": " & key
  55. end if
  56. end if
  57. Next
  58. GetOfficeKey = final & vbnewline
  59. End If
  60. End Function
  61.  
  62. Function GetWinKey()
  63. Set wshshell = CreateObject("WScript.Shell")
  64. edition = wshshell.RegRead("HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProductName")
  65. oem = ucase(mid(wshshell.RegRead("HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProductID"), 7, 3))
  66. key = GetKey("HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\DigitalProductId")
  67. set wshshell = Nothing
  68. if oem <> "OEM" then oem = "Retail"
  69. GetWinKey = edition & " " & oem & ": " & key
  70. End Function
  71.  
  72. Function GetKey(sReg)
  73. Set wshshell = CreateObject("WScript.Shell")
  74. GetKey = ConvertToKey(wshshell.RegRead(sReg))
  75. Set wshshell = Nothing
  76. End Function
  77.  
  78. Function ConvertToKey(key)
  79. Const KeyOffset = 52
  80. i = 28
  81. Chars = "BCDFGHJKMPQRTVWXY2346789"
  82. Do
  83. Cur = 0
  84. x = 14
  85. Do
  86. Cur = Cur * 256
  87. Cur = key(x + KeyOffset) + Cur
  88. key(x + KeyOffset) = (Cur \ 24) And 255
  89. Cur = Cur Mod 24
  90. x = x - 1
  91. Loop While x >= 0
  92. i = i - 1
  93. KeyOutput = Mid(Chars, Cur + 1, 1) & KeyOutput
  94. If (((29 - i) Mod 6) = 0) And (i <> -1) Then
  95. i = i - 1
  96. KeyOutput = "-" & KeyOutput
  97. End If
  98. Loop While i >= 0
  99. ConvertToKey = KeyOutput
  100. End Function
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Visual Basic.Net Compiler version 0.0.0.5914 (Mono 2.4.2 - r)
Copyright (C) 2004-2008 Rolf Bjarne Kvinge. All rights reserved.


/home/ZMbaKM/prog.vb (1,7) : Error VBNC30203: Not valid as identifier.
/home/ZMbaKM/prog.vb (3,7) : Error VBNC30203: Not valid as identifier.
/home/ZMbaKM/prog.vb (4,12) : Error VBNC30203: Not valid as identifier.
/home/ZMbaKM/prog.vb (7,11) : Error VBNC30203: Not valid as identifier.
/home/ZMbaKM/prog.vb (9,3) : Error VBNC30203: Not valid as identifier.
/home/ZMbaKM/prog.vb (10,8) : Error VBNC30203: Not valid as identifier.
/home/ZMbaKM/prog.vb (11,8) : Error VBNC30203: Not valid as identifier.
/home/ZMbaKM/prog.vb (12,8) : Error VBNC30203: Not valid as identifier.
/home/ZMbaKM/prog.vb (14,8) : Error VBNC30203: Not valid as identifier.
/home/ZMbaKM/prog.vb (15,7) : Error VBNC30203: Not valid as identifier.
/home/ZMbaKM/prog.vb (16,16) : Error VBNC30203: Not valid as identifier.
/home/ZMbaKM/prog.vb (17,8) : Error VBNC30203: Not valid as identifier.
/home/ZMbaKM/prog.vb (18,15) : Error VBNC30203: Not valid as identifier.
/home/ZMbaKM/prog.vb (19,15) : Error VBNC30203: Not valid as identifier.
/home/ZMbaKM/prog.vb (20,16) : Error VBNC30203: Not valid as identifier.
/home/ZMbaKM/prog.vb (21,16) : Error VBNC30203: Not valid as identifier.
/home/ZMbaKM/prog.vb (22,7) : Error VBNC30203: Not valid as identifier.
/home/ZMbaKM/prog.vb (24,9) : Error VBNC30203: Not valid as identifier.
/home/ZMbaKM/prog.vb (25,7) : Error VBNC30203: Not valid as identifier.
/home/ZMbaKM/prog.vb (26,8) : Error VBNC30203: Not valid as identifier.
/home/ZMbaKM/prog.vb (27,8) : Error VBNC30203: Not valid as identifier.
/home/ZMbaKM/prog.vb (28,9) : Error VBNC30203: Not valid as identifier.
/home/ZMbaKM/prog.vb (29,7) : Error VBNC30203: Not valid as identifier.
/home/ZMbaKM/prog.vb (30,8) : Error VBNC30203: Not valid as identifier.
/home/ZMbaKM/prog.vb (31,9) : Error VBNC30203: Not valid as identifier.
/home/ZMbaKM/prog.vb (32,8) : Error VBNC30203: Not valid as identifier.
/home/ZMbaKM/prog.vb (33,11) : Error VBNC30203: Not valid as identifier.
/home/ZMbaKM/prog.vb (34,8) : Error VBNC30203: Not valid as identifier.
/home/ZMbaKM/prog.vb (35,11) : Error VBNC30203: Not valid as identifier.
/home/ZMbaKM/prog.vb (36,8) : Error VBNC30203: Not valid as identifier.
/home/ZMbaKM/prog.vb (37,7) : Error VBNC30203: Not valid as identifier.
/home/ZMbaKM/prog.vb (38,12) : Error VBNC30203: Not valid as identifier.
/home/ZMbaKM/prog.vb (39,10) : Error VBNC30203: Not valid as identifier.
/home/ZMbaKM/prog.vb (40,10) : Error VBNC30203: Not valid as identifier.
/home/ZMbaKM/prog.vb (41,20) : Error VBNC30203: Not valid as identifier.
/home/ZMbaKM/prog.vb (42,15) : Error VBNC30203: Not valid as identifier.
/home/ZMbaKM/prog.vb (43,10) : Error VBNC30203: Not valid as identifier.
/home/ZMbaKM/prog.vb (44,16) : Error VBNC30203: Not valid as identifier.
/home/ZMbaKM/prog.vb (45,9) : Error VBNC30203: Not valid as identifier.
/home/ZMbaKM/prog.vb (46,18) : Error VBNC30203: Not valid as identifier.
/home/ZMbaKM/prog.vb (47,23) : Error VBNC30203: Not valid as identifier.
/home/ZMbaKM/prog.vb (48,13) : Error VBNC30203: Not valid as identifier.
/home/ZMbaKM/prog.vb (49,15) : Error VBNC30203: Not valid as identifier.
/home/ZMbaKM/prog.vb (50,15) : Error VBNC30203: Not valid as identifier.
/home/ZMbaKM/prog.vb (51,14) : Error VBNC30203: Not valid as identifier.
/home/ZMbaKM/prog.vb (52,16) : Error VBNC30203: Not valid as identifier.
/home/ZMbaKM/prog.vb (53,18) : Error VBNC30203: Not valid as identifier.
/home/ZMbaKM/prog.vb (54,21) : Error VBNC30203: Not valid as identifier.
/home/ZMbaKM/prog.vb (55,23) : Error VBNC30203: Not valid as identifier.
/home/ZMbaKM/prog.vb (56,14) : Error VBNC30203: Not valid as identifier.
/home/ZMbaKM/prog.vb (57,13) : Error VBNC30203: Not valid as identifier.
/home/ZMbaKM/prog.vb (57,13) : Error VBNC30041: Too many errors.
Exception of type 'vbnc.TooManyErrorsException' was thrown.
  at vbnc.Report.ShowMessage (Boolean SaveIt, vbnc.Message Message) [0x00080] in /var/tmp/portage/dev-lang/mono-basic-2.4.2/work/mono-basic-2.4.2/vbnc/vbnc/source/General/Report.vb:342 
  at vbnc.Report.ShowMessage (Messages Message, Span Location, System.String[] Parameters) [0x00000] in /var/tmp/portage/dev-lang/mono-basic-2.4.2/work/mono-basic-2.4.2/vbnc/vbnc/source/General/Report.vb:259 
  at vbnc.Report.ShowMessage (Messages Message, System.String[] Parameters) [0x00054] in /var/tmp/portage/dev-lang/mono-basic-2.4.2/work/mono-basic-2.4.2/vbnc/vbnc/source/General/Report.vb:269 
  at vbnc.Compiler.Compile () [0x005a3] in /var/tmp/portage/dev-lang/mono-basic-2.4.2/work/mono-basic-2.4.2/vbnc/vbnc/source/General/Compiler.vb:651 
  at vbnc.Compiler.Compile (System.String[] CommandLine) [0x00057] in /var/tmp/portage/dev-lang/mono-basic-2.4.2/work/mono-basic-2.4.2/vbnc/vbnc/source/General/Compiler.vb:279 
  at vbnc.Main.Main (System.String[] CmdArgs) [0x0000f] in /var/tmp/portage/dev-lang/mono-basic-2.4.2/work/mono-basic-2.4.2/vbnc/vbnc/source/General/Main.vb:55 
Failed compilation took 00:00:00.5686880
stdout
Standard output is empty