The Un-Official Proxomitron Forum

Full Version: Get OS
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hey guys! Is it possible with vbscript to get the OS of the computer its running on? I've searched all over Google and nothing good comes up.
Try this:

http://members.ozemail.com.au/~enigman/vbs.../vb_binfo6.html

Script source link doesn't work... Sad
That's JavaScript too. It wasn't for HTML either, I want it for a VBS file.
Quote:http://members.ozemail.com.au/~enigman/v...info6.html

The Nosy Javascript filter stops it.
Well, I still can't see the source, but none of you know a simple line a code to get the OS?
Shea,

No, in VBScript, I don't know a simple line of code, for anything. Sad [lol]

In the Document Object Model (DOM), you want to access the window.navigator.oscpu object - that will return the OS no matter what scripting language asked for it.

In your researches on the DOM, I do not recommend that you spend much time at the W3C site - they go out of their way to make sure that this kind of information is not available. For some reason, they seem to think that all anybody would ever be interested in is how the DOM was originally made. A pox upon them, I say.

Instead, I Googled for 'DOM reference', and the first hit was the Gecko project. Everything was laid out nice and clear, and any script programmer worth his/her salt should keep this site bookmarked for future reference.

So says....


Oddysey
If you want to run the script locally, you can get the info from the registry ...
Code:
Set WshShell = WScript.CreateObject("WScript.Shell")
WScript.Echo WshShell.RegRead("HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProductName")
... or the system environment
Code:
Set WshShell = WScript.CreateObject("WScript.Shell")
Set WshSysEnv = WshShell.Environment("SYSTEM")
WScript.Echo WshSysEnv("OS")
Thanx sidki, I had the system environment code, but it wasn't working. Now i realize I was missing part of it.
Sorry guys, it still isn't working. When the message box pops up to tell the OS, it's blank. I have Win98 and WSH 5.6 if that matters.
IIRC there is no "OS" environment variable in Win98 (type "set" in a DOS box).
However, there is an OS value in the registry:
HKLM\Software\Microsoft\Windows\CurrentVersion\ProductName

HTH
Reference URL's