Using vbscript, how to determine the whether a server is "Windows 2003 Standard vs Windows 2003 R2?

Posted on 2009-04-17
Last Modified: 2012-05-06
I'm stuck and need some assistance. I'm using someone's slick vbscript to install and configure the SNMP service on a bunch of computers. The one failing is that this script was written before Windows 2003 R2 was released. I'm savvy enough to make the changes, but I've run into an issue.

VBscript/WMI doesn't return whether the server is running Windows Server 2003 or Windows Server 2003 R2. The Caption entry from the Win32_OperatingSystem method reports both versions as the same.

In a nutshell, I'm querying the OS, determining it's version, modifying the registry to point the installation source media to places on the network that have the OS media by the OS type and service pack verions so that with SNMP is installed, it doesn't prompt for a CD.

Since the script can't tell the difference between Windows 2003 (non R2) and Windows 2003 R2, it possible that it would use non-R2 media in an R2 installation which I don't feel is acceptable.

So, as the title says "how do I determine whether a server is running Windows 2003 non-R2 and Windows 2003 R2. I can already tell the difference in the Standard vs Enterprise flavors and the service Pack levels.

Many thanks in advance!
Question by:SBrummer68
    LVL 39

    Accepted Solution

    Have you tried the following? It seems to work...

    strComputer = "."
    Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
    Set colItems = objWMIService.ExecQuery("Select * from
    For Each objItem in colItems
        If InStr(objItem.OtherTypeDescription, "R2") Then
            WScript.Echo "This computer is running Windows Server 2003 R2."
            WScript.Echo "This computer is not running Windows Server 2003 R2."
        End If

    Open in new window

    LVL 39

    Expert Comment

    Sorry, forgot the link (always show credits to where you got a solution from). Here you go:
    LVL 1

    Author Closing Comment

    Thank you! I'll say that as soon as I asked the question, I resumed my searching on the Internet and found the same information only presented much differently. I appreciate you extremely fast response!
    LVL 39

    Expert Comment

    > I appreciate you extremely fast response!

    you're welcome, glad to be of some help

    > and found the same information only presented much differently.

    aha, so you actually found the solution yourself. Nice to give me the credits, still :)

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    Recently I finished a vbscript that I thought I'd share.  It uses a text file with a list of server names to loop through and get various status reports, then writes them all into an Excel file.  Originally it was put together for our Altiris server…
    In this article we want to have a look at the directory attributes which are used by Microsoft to store the so called Security Identifiers (SID). These SIDs plays an important role in delegating and granting permissions and in authentication of trus…
    This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now