Sign in to follow this  
Followers 0
Taggs

How to identify OS version remotely?

18 posts in this topic

Can anybody tell me a command or way of identifying which version of the OS is on the server I remotely connect to?

I tried dos VER and Help > About from a window and this only tells me that it is Windows 2000, build number and service pack.

The information I am trying to collect is, is the server a Windows 2000 Std, Windows 2000 Adv, Etc...

If I click the start button on the server it comes up with the Windows version on the start bar but not if I’m remotely connected and I don’t wont to have to go around several sites collecting data for over 100 servers.

Thanks

Taggs

Don't worry, I've sorted now.

Thanks :thumbup

Edited by Taggs
0

Share this post


Link to post
Share on other sites

You can do this with some WMI magic in a vb script:

Option Explicit
Dim objWMI, objItem, colItems
Dim strComputer, VerOS, VerBig, Ver9x, Version9x, OS, OSystem

strComputer = "COMPUTERNAMEHERE"

Set objWMI = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

Set colItems = objWMI.ExecQuery("Select * from Win32_OperatingSystem",,48)

For Each objItem in colItems
VerBig = Left(objItem.Version,3)
Next

Select Case VerBig
Case "5.0" OSystem = "W2K"
Case "5.1" OSystem = "XP"
Case "5.2" OSystem = "Windows 2003"
Case "4.0" OSystem = "NT 4.0"
Case Else OSystem = "Unknown (Win9x perhaps?)"
End Select

Wscript.Echo "Version No : " & VerBig & vbCr _
& "OS System : " & OSystem

WScript.Quit

Edited by cluberti
0

Share this post


Link to post
Share on other sites

The easiet way would be to to try MSINFO32 /computer ComputerName

0

Share this post


Link to post
Share on other sites

Hi

I was searching for the same thing some time ago. The one I use is a simple batch job “se below”

Hi

I was searching for the same thing some time ago. The one I use is a simple batch job “se below”

::

@echo off

cls

echo.

::

ver | find "Windows XP" >nul

if not errorlevel 1 goto XP

::

ver | find "Windows 2000" >nul

if not errorlevel 1 goto 2K

::

ver | find "Windows NT" >nul

if not errorlevel 1 goto NT

::

ver | find "Windows ME" >nul

if not errorlevel 1 goto ME

::

ver | find "Windows 98" >nul

if not errorlevel 1 goto 98

::

ver | find "Windows 95" >nul

if not errorlevel 1 goto 95

::

ver | find "OEM Service Release" >nul

if not errorlevel 1 goto OEM

::

ver | find "MS-DOS" >nul

if not errorlevel 1 goto DOS

::

echo OS version not found...

goto end

:XP

echo OS is Windows XP ...

goto end

:2K

echo OS is Windows 2K ...

goto end

:NT

echo OS is Windows NT ...

goto end

:ME

echo OS is Windows ME ...

goto end

:98

echo OS is Windows 98 ...

goto end

:95

echo OS is Windows 95 ...

goto end

:OEM

echo OS is Windows OSR ...

goto end

:DOS

echo OS is MS-DOS mode ...

:end

echo.

::

pause

Creating_a_OS_batch_file.txt

0

Share this post


Link to post
Share on other sites

I just boot PHLAK and run nmap. It's as simple as that. :unsure:

0

Share this post


Link to post
Share on other sites
The easiet way would be to to try MSINFO32 /computer ComputerName

MSINFO32 doesn't exist on Windows XP or Windows Server 2003. The replacement command is systeminfo.

systeminfo /s remote_computer

0

Share this post


Link to post
Share on other sites

Hi agin

If it’s for a logon script I would use the Batch Job, it doesn’t involve any extended features nor programs.. and it works. Try it just copy and paste, run it and you’ll see..

It’s simple especially if you have different machines on your network.

I’ve used the script above for antivirus updates, and patching……

0

Share this post


Link to post
Share on other sites
MSINFO32 doesn't exist on Windows XP or Windows Server 2003. The replacement command is systeminfo.

systeminfo /s remote_computer

MSINFO32 is present on XP, XP x64 and 2003 and can be called directly from Start / Run.

It does not, by default, work from a command prompt as it resides in "%programfiles%\Common Files\Microsoft Shared\MSInfo".

The MPS reporting tools used at Microsoft call MSInfo32.exe when gathering system information on any version of Windows.

If the machines are in a domain then doesn't the computer object store the OS version reported when the computer last booted up?

0

Share this post


Link to post
Share on other sites

Hi agin

It’s okay if you'r running XP on you’r LAN or local net.

but what if you also have X numbers of Win2000 machines and other types of systems.

I’m not saying that my version is the smartest one, but the smart solution would be to run a non OS. Spec. utility in you’r logonscript.

And a Batch job "old but still running" are non OS. spec.

0

Share this post


Link to post
Share on other sites

If you're running the script on the local system you can use the Kix macros @ProductType and @ProductSuite to get detailed info from Win9x to Vista. Or a WMI query, as mentioned above, in your favorite language to pull the OS name. But I believe systeminfo run against a remote PC will pull from the same WMI namespace.

0

Share this post


Link to post
Share on other sites
Hi

I was searching for the same thing some time ago. The one I use is a simple batch job “se below

Sorry, but I don't see the actual advantage of your batch file :blink: as compared to simply run

ver

jaclaz

0

Share this post


Link to post
Share on other sites

The difference is the amount of information. Unless you know all of the major/minor versions by heart, or want to parse it out, using a script gives much more info. I guess it really depends on how detailed he needs as to what the best/easiest option will be. From his question, I was assuming he was looking for a method to obtain a more detailed result.

I tried dos VER and Help > About from a window and this only tells me that it is Windows 2000, build number and service pack.

The information I am trying to collect is, is the server a Windows 2000 Std, Windows 2000 Adv, Etc...

@Taggs - Do you have an idea of how you want to proceed? If you could tell us what script language you're comfortable with we might be able to toss out a quick code snippet, if you haven't already done so.

Edited by Mordac85
0

Share this post


Link to post
Share on other sites

Some people have missed the point that he wants to do it remotely. :)

If the machines are in a domain then doesn't the computer object store the OS version reported when the computer last booted up?

Yep, it does, including service pack level. :)

Edited by nmX.Memnoch
0

Share this post


Link to post
Share on other sites
Some people have missed the point that he wants to do it remotely. :)

Yep, or more simply a lot of people do not actually READ previous posts and just write what they feel like:

@Mordac85

I was referring to the supposed advantage of a script like the one that GliX suggested, that, apart from not being remotely working as required, simply PARSES the output of the "ver" command, actually STRIPPING OUT most of the info (i.e. version).

jaclaz

Edited by jaclaz
0

Share this post


Link to post
Share on other sites

Here's a KiX script that will query all the computers in a specific OU and then gather the OS information using WMI. It'll write all of the information to a Comma Separated Values (CSV) file and then open the file at the end of the script.

You'll need to edit the $objOU value.

Break On
CLS
Dim $Filter[0],$objWMIService,$colItems,$objItem

$Filter[0]="Computers"; Or replace "Group" with "User" or "Computer"

$objOU = GetObject("LDAP://OU=ComputersOU,DC=example,DC=company,DC=com")
$objOU.Filter = $Filter[0]

$X = RedirectOutput("os_versions.csv",1)
; >>>>>>>>Header Row<<<<<<<<
"Computer Name,Status,Operating System,Service Pack"

For Each $objOUItem in $objOU
$WK = Trim(SubStr($objOUItem.Name,4))
? "$WK"
Shell '%COMSPEC% /C ping -n 1 -w 20 $WK | Find /I "TTL=" > ping.txt'
If Open(1,"ping.txt",2) = 0
$LINE = ReadLine(1)
If InStr($LINE,"TTL=")
",ONLINE"
$colItems = GetObject("winmgmts:\\$WK\root\cimv2").ExecQuery("Select * from Win32_OperatingSystem",,48)
For Each $objItem in $colItems
$OS = $objItem.Caption
$SP = $objItem.CSDVersion
",$OS,$SP"
Next
Else
",OFFLINE"
EndIf
EndIf
$X = Close(1)
Next

$X = RedirectOutput("")
Del "ping.txt"
Shell '%COMSPEC% /C START "" os_versions.csv'
Exit

0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.