nmX.Memnoch Posted April 11, 2006 Share Posted April 11, 2006 (edited) 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 April 11, 2006 by nmX.Memnoch Link to comment Share on other sites More sharing options...
jaclaz Posted April 13, 2006 Share Posted April 13, 2006 (edited) 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:@Mordac85I 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 April 13, 2006 by jaclaz Link to comment Share on other sites More sharing options...
nmX.Memnoch Posted April 13, 2006 Share Posted April 13, 2006 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 OnCLSDim $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 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now