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

Batch or VB script to determine what version of Windows (XP or 7) our machines are?

hi guys

We are trying to deploy software, either 32 bit or 64 bit, depending on the version of Windows. However, there are around 150 PC's and we just wanted to know whether we have Windows XP or Windows7 on these PC's.

Is there a way I can run a batch file or VB script on our Domain Controller to obtain this information? I can see that in AD, if I right click on the computer properties and select the Operating System tab that this information is available, but is there a way we could extract that information with a script and associate that OS to the computer name?

The controller is a Windows 2003 version.

Thanks for helping
Yashy
0
Yashy
Asked:
Yashy
  • 4
  • 3
2 Solutions
 
Rgonzo1971Commented:
HI,

pls try
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
Set oss = objWMIService.ExecQuery("Select * from Win32_OperatingSystem")

For Each os In oss
    Debug.Print os.Caption & vbCrLf & "Version: " & os.Version
Next
End Sub

Open in new window

Regards
0
 
YashyAuthor Commented:
Hey Rgonzo,

Thanks so much for sending me this. I tried this by making it a VBS script and ran it. Sadly it errored.
0
 
Rgonzo1971Commented:
replace Debug.Print with WScript.Echo
0
Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

 
YashyAuthor Commented:
Same thing.

I get an error saying 'Windows Script Host'

Line: 7
Char: 1
Error: Expected Statement
Code 800A0400
Source; Microsoft VBscript compilation error.

Is this supposed to output a text file or export into a specific location?
0
 
Rgonzo1971Commented:
delete end sub
0
 
YashyAuthor Commented:
this only gave me the version of our actual Domain controller.

That's my fault, I  went on writing about the domain controller. Is there a way to run a similar file, but to obtain a list of all the PC's in an organisational unit in AD, so that all of the 150 PC's we have, their information can be extracted to tell us which version of windows each runs? Apologies for the confusion, and thanks for helping.
0
 
YashyAuthor Commented:
I will close this and give you points and do another post for this. As it's unfair the way it was posted for you.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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