/build/static/layout/Breadcrumb_cap_w.png

VBScript to Return OS Version

I am looking to upgrade the WMI on all of our machines to v4.5 for XP and Serv2003 and v5.0 for Win7/Serv2008. What I would like to do is have a script that would determine what OS the machine is running and return a value to batch script based on the OS version.

I am sure this is relatively simplistic, but I am a complete newb to scripting.

I have read the following:

http://anandthearchitect.wordpress.com/2008/11/12/find-os-type-using-vbscript-ready-to-use-vbscript-function-right-here/

and it seems to be fairly close to what I am wanting. Will the FindOSType = OSName provide a return to a batch script if this .vbs is called from the batch script?

I have a script that I use to determine if a machine is 32 bit or 64 bit and I would like to find a way to integrate all of this together as well.

Anyway, sorry to be the complete noob, but I hope someone can help me out with this.

-Jason

0 Comments   [ + ] Show comments

Answers (4)

Posted by: anonymous_9363 13 years ago
Red Belt
0
Why bother? The WMI package as supplied will do everything it needs to do.

If you're new to scripting, I'd recommend forgetting about batch files and do all your coding in script. Batch is restricting and you'll find millions of lines of VBS code for pretty much anything you want to do.

For a kick-off, have a search for any of my responses in this forum. You'll find a selection of links to sites which have code samples. Search for 'computerperformance' (that's one word).

I'll repeat my mantra, just for completeness: always code as if NOTHING works. So, when setting an object - even the basics like FileSystemObject - test that it got created before your next piece of code. If a function should return a string, make sure it got a string with content, not an empty one. And so on.
Posted by: dyehardfan 13 years ago
Second Degree Blue Belt
0
Unless I am missing something, MS says there are different files to install based on what OS the machine is running:

http://www.microsoft.com/downloads/en/details.aspx?FamilyID=5a58b56f-60b6-4412-95b9-54d056d6f9f4&displaylang=en

[hr]Download the file that is appropriate for your operating system version and platform.

For Windows Vista, Windows Vista Service Pack 1 and Windows Server 2008:
x86 Platform: Windows6.0-KB942288-v2-x86.msu
x64 Platform: Windows6.0-KB942288-v2-x64.msu
IA64 Platform: Windows6.0-KB942288-v2-ia64.msu

For Windows XP Service Pack 2 and Windows XP Service Pack 3 (32-bit platforms):
x86 Platform: WindowsXP-KB942288-v3-x86.exe

For Windows Server 2003 Service Pack 1, Windows Server 2003 Service Pack 2 and Windows XP 64-bit Editions:
x86 Platform: WindowsServer2003-KB942288-v4-x86.exe
x64 Platform: WindowsServer2003-KB942288-v4-x64.exe
IA64 Platform: WindowsServer2003-KB942288-v4-ia64.exe

[hr]

And I do agree with you that I should be doing as much as possible through scripting. I am attempting to learn as much as possible, but I am a one man show splitting time between imaging, app deployment/scripting, inventory & asset management, hardware repair and AD administration. Only so many hours in the day so my learning process is a slow one. I'll do a quick scan for some of the resources you speak of...
Posted by: hashref 13 years ago
Senior Yellow Belt
0
if you need a bat command try something like this:

reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v ProductName

I would do as VBScab suggested and go pure vbscript, tho.
Posted by: cblake 13 years ago
Red Belt
0
dyehardfan You have a K1000 and K2000; why not use those? The managed install, scripting, and/or patching features could easily target specific OS's and machines that are missing the applicable software.
Maybe that was your intent? If so, note that this thread is for general scripting, not K1000 scripting.
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ