Source language: Translate to:

Retrieve OS info in VBscript

Questions and information about using VBScript and JavaScript in NeoBook functions

Moderator: Neosoft Support

Postby Tony Kroos » Mon Apr 09, 2012 10:19 pm

oh my god, where did you get this s**t? )

Code: Select all
{NeoBook Function}
Version=5,70
Language=VBScript
Comment=OSInfo 1.1|Neobook function to retrieve OS info
{End}
On Error Resume Next
Set dtmConvertedDate = CreateObject("WbemScripting.SWbemDateTime")
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
Set colOS = objWMIService.ExecQuery("Select * from Win32_OperatingSystem")
Set colDm = objWMIService.ExecQuery("Select * from Win32_ComputerSystem")
For Each objOS in colOS
    dtmConvertedDate.Value = objOS.InstallDate
    dtmInstallDate = dtmConvertedDate.GetVarDate
    nbSetVar "[OS_Caption]", objOS.Caption
    nbSetVar "[OS_Version]", objOS.Version
    nbSetVar "[OS_BuildNumber]", objOS.BuildNumber
    nbSetVar "[OS_Architecture]", objOS.OSArchitecture
    nbSetVar "[OS_InstallDate]", dtmInstallDate
    nbSetVar "[OS_CodeSet]", objOS.CodeSet
    nbSetVar "[OS_Language]", objOS.OSLanguage
    nbSetVar "[OS_Locale]", objOS.Locale
    nbSetVar "[OS_SKU]", objOS.OperatingSystemSKU
    nbSetVar "[OS_SP]", objOS.ServicePackMajorVersion
    nbSetVar "[OS_Key]", objOS.SerialNumber
Next
For Each objDm in colDm
If objDm.PartOfDomain Then
        nbSetVar "[OS_PartOf]", "Domain"
    Else
        nbSetVar "[OS_PartOf]", "Workgroup"
    End If
    nbSetVar "[OS_Domain]", objDm.Domain
Next
nbSetVar "[OSInfo]", Err.Number
Set objWMIService = Nothing
Set dtmConvertedDate = Nothing
Set colOS = Nothing
Set colDm = Nothing


use Google for more info about variables...

I am trying to make a simple application to show ... & Key

It is possible, but I can't see any reasons why do you need to extract system key
Last edited by Tony Kroos on Tue Apr 10, 2012 12:58 am, edited 1 time in total.
Tony Kroos
 
Posts: 402
Joined: Thu Oct 15, 2009 3:43 pm

Postby Tony Kroos » Tue Apr 10, 2012 12:55 am

This script doesn't work with registry, so no matter 32 or 64 bit...
To retrieve serial number key (not Product Key), add this (edited above):
nbSetVar "[OS_Key]", objOS.SerialNumber
Next
For Each objDm in colDm
...


You'll get key to [OS_Key] variable
If you want Windows Product key (XXXXX-XXXXX-XXXXX-XXXXX-XXXXX), then still can't see such a reason... I would write the key down on paper and put in my shorts to backup it )
Tony Kroos
 
Posts: 402
Joined: Thu Oct 15, 2009 3:43 pm

Postby Tony Kroos » Tue Apr 10, 2012 3:13 am

but my question is how to make my VBScript work in Neobook on my 64bit OS
This script won't work. native *.vbs rely on system script engine (if x64 then vbs runs as x64 and so on...), but neobook is a 32bit application, and it always run in 32bit mode on x64 system (and functions too, of course), there's no direct access to x64 registry entries. however, it is still possible...
you may try REG QUERY /? to obtain key value you need.
Tony Kroos
 
Posts: 402
Joined: Thu Oct 15, 2009 3:43 pm

Postby dpayer » Tue Apr 10, 2012 6:45 am

Tony Kroos wrote:oh my god, where did you get this s**t? )


Code: Select all
call "tact" "courtesy" "politeness"
gosub "tryagain"


This is one of my favorite self maintenance routines!

David P.
User avatar
dpayer
 
Posts: 1380
Joined: Mon Apr 11, 2005 5:55 am
Location: Iowa - USA

Postby Tony Kroos » Tue Apr 10, 2012 7:58 am

okay I've just updated my brain's firmware with this one )
Tony Kroos
 
Posts: 402
Joined: Thu Oct 15, 2009 3:43 pm

Postby Pilou » Tue Apr 10, 2012 1:43 pm

Good evening
Interesting post about key product + printing

Vbs code Abdullah

Sun Act: Set Act = CreateObject ("WScript.Shell")

Sun Ky1, KY2, KY3

Ky1 GetKey = (Act.RegRead ("HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ Windows NT \ CurrentVersion \ DigitalProductId"))
KY2 Act.RegRead = ("HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ Windows NT \ CurrentVersion \ ProductName")
KY3 Act.RegRead = ("HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ Windows NT \ CurrentVersion \ BuildLab")

publication.nbSetVar "[% 1]", KY2 + "" + KY3
publication.nbSetVar "[% 2]", Ky1

Function GetKey (rpk)
Dim i, j, DwAcum, ProKey, SzPosChar
RpkOffset const = 52 i = 28
SzPosChar = "BCDFGHJKMPQRTVWXY2346789"
Do
DwAcum = 0: j = 14
Do
DwAcum DwAcum * 256 =
DwAcum = rpk (j + rpkOffset) + DwAcum
rpk (j + rpkOffset) = (DwAcum \ 24) and 255
DwAcum DwAcum Mod 24 =
j = j-1
Loop While j> = 0
i = i-1: ProKey = mid (SzPosChar, DwAcum 1.1) & ProKey
If (((29-i) Mod 6) = 0) And (i <> -1) Then
i = i-1: ProKey = "-" & ProKey
End If
Loop While i> = 0
GetKey = ProKey
End Function

Edit: Tony croos
You'll get to key [OS_Key] variable
If you want Windows Product key (XXXXX-XXXXX-XXXXX-XXXXX-XXXXX), then still can not see sa situation Reason ... I would write the key down on paper and put in my shorts to backup it)

Please download the following zip

Explanations and tutorial soon on NéofrbooK

http://neofrbook.free.fr/

http://jeanlouis.gastoldi.free.fr/infoproduit.zip

Pilou
User avatar
Pilou
 
Posts: 545
Joined: Sun Oct 16, 2005 4:17 pm

Postby Pilou » Tue Apr 10, 2012 4:12 pm

Ok
However good script vbs !

pilou
User avatar
Pilou
 
Posts: 545
Joined: Sun Oct 16, 2005 4:17 pm

Postby Pilou » Tue Apr 10, 2012 4:16 pm

Pilou wrote:Good evening
Interesting post about key product + printing

Vbs code INTERNET

Sun Act: Set Act = CreateObject ("WScript.Shell")

Sun Ky1, KY2, KY3

Ky1 GetKey = (Act.RegRead ("HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ Windows NT \ CurrentVersion \ DigitalProductId"))
KY2 Act.RegRead = ("HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ Windows NT \ CurrentVersion \ ProductName")
KY3 Act.RegRead = ("HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ Windows NT \ CurrentVersion \ BuildLab")

publication.nbSetVar "[% 1]", KY2 + "" + KY3
publication.nbSetVar "[% 2]", Ky1

Function GetKey (rpk)
Dim i, j, DwAcum, ProKey, SzPosChar
RpkOffset const = 52 i = 28
SzPosChar = "BCDFGHJKMPQRTVWXY2346789"
Do
DwAcum = 0: j = 14
Do
DwAcum DwAcum * 256 =
DwAcum = rpk (j + rpkOffset) + DwAcum
rpk (j + rpkOffset) = (DwAcum \ 24) and 255
DwAcum DwAcum Mod 24 =
j = j-1
Loop While j> = 0
i = i-1: ProKey = mid (SzPosChar, DwAcum 1.1) & ProKey
If (((29-i) Mod 6) = 0) And (i <> -1) Then
i = i-1: ProKey = "-" & ProKey
End If
Loop While i> = 0
GetKey = ProKey
End Function

Edit: Tony croos
You'll get to key [OS_Key] variable
If you want Windows Product key (XXXXX-XXXXX-XXXXX-XXXXX-XXXXX), then still can not see sa situation Reason ... I would write the key down on paper and put in my shorts to backup it)

Please download the following zip

Explanations and tutorial soon on NéofrbooK

http://neofrbook.free.fr/

http://jeanlouis.gastoldi.free.fr/infoproduit.zip

Pilou
User avatar
Pilou
 
Posts: 545
Joined: Sun Oct 16, 2005 4:17 pm

Postby Pilou » Sun Apr 29, 2012 6:22 pm

good evening

Code: Select all
PlugPilou: CléWindows


This is my first plugin! CléWindows made ​​following the topic of Tony
Download link

http://neofrbook.free.fr/crbst_46.html

Tried on windows XP pro but not on higher versions!

Important please put the functions in VBS (F11)

The file includes: + plugin. Exe + the Vbs+pub

Plugin totally free for private use.

Help me please leave me your comments, reflections, criticism etc. ... at: http://neofrbook.free.fr/crbst_46.html

Thank you in advance

pilou
User avatar
Pilou
 
Posts: 545
Joined: Sun Oct 16, 2005 4:17 pm


Return to NeoBook Functions - VBScript & JavaScript

Who is online

Users browsing this forum: No registered users and 1 guest