• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 646
  • Last Modified:

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

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!
0
SBrummer68
Asked:
SBrummer68
  • 3
1 Solution
 
abelCommented:
Have you tried the following? It seems to work...

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

Open in new window

0
 
abelCommented:
Sorry, forgot the link (always show credits to where you got a solution from). Here you go: http://www.microsoft.com/technet/scriptcenter/resources/qanda/apr06/hey0420.mspx
0
 
SBrummer68Author Commented:
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!
0
 
abelCommented:
> 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 :)
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now