Solved

Is there a vbs which can give us the OS from a server list file?

Posted on 2011-03-22
10
395 Views
Last Modified: 2012-08-14
Is there a vbs which can give us the OS from a server list file? A script which can write in the file the OS of each servers.
0
Comment
Question by:SAM2009
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
  • +1
10 Comments
 
LVL 31

Expert Comment

by:Justin Owens
ID: 35193652
So, you basically want a script which will:

1) Open a CSV which contains a list of servers
2) Loop through the list and
2a) Remotely scan each server to determine OS
2b) Write to the CSV the determined OS

Does that summarize your needs?

DrUltima
0
 
LVL 1

Author Comment

by:SAM2009
ID: 35194025
Yes that is exactly what I need! :)))
0
 
LVL 65

Accepted Solution

by:
RobSampson earned 250 total points
ID: 35195172
0
Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

 
LVL 31

Expert Comment

by:Justin Owens
ID: 35195716
Rob,

Doesn't your script (which is great, BTW) depend on getting info from AD rather than connecting the to listed server?  What if the computer in the list is not in AD or if AD does not have the correct OS identified?

Thanks for clarifying!

DrU
0
 
LVL 65

Expert Comment

by:RobSampson
ID: 35195897
Hi, yes, it does indeed require that the Active Directory computer account exists, and also that it's accurate, but any computer that contacts the AD with it's current OS will be accurate.  If the computers are not joined to the domain, then my script is useless ;-)

Rob.
0
 
LVL 3

Assisted Solution

by:Anurag_Tiwari
Anurag_Tiwari earned 250 total points
ID: 35199128
Option Explicit

Const ForReading = 1

Dim objWMIService, objItem, colItems
Dim strComputer, strList
Dim oFSO, sFile, oFile
Dim Stuff, myFSO, WriteStuff, dateStamp

 Set oFSO = CreateObject("Scripting.FileSystemObject")
 sFile = "c:\Servers.txt"
If oFSO.FileExists(sFile) Then
Set oFile = oFSO.OpenTextFile(sFile, 1)
Do While Not oFile.AtEndOfStream
    strComputer = oFile.ReadLine
' WMI Connection to the object in the CIM namespace
Set objWMIService = GetObject("winmgmts:\\" _
& strComputer & "\root\cimv2")

' WMI Query to the Win32_OperatingSystem
Set colItems = objWMIService.ExecQuery _
("Select * from Win32_OperatingSystem")
Set myFSO = CreateObject("Scripting.FileSystemObject")
      
' For Each... In Loop (Next at the very end)
For Each objItem in colItems
Set WriteStuff = myFSO.OpenTextFile("c:\Server-OS-Details.csv", 8, True)
WriteStuff.WriteLine(objItem.CSName & ";" & objItem.Caption & ";" & objItem.Version & ";" & objItem.CSDVersion)
WriteStuff.Close
Set WriteStuff = Nothing
Next
Loop
'Set myFSO = Nothing
oFile.Close
End If      

you can use objItem.Description,objItem.Manufacturer,objItem.CodeSet,objItem.CountryCode,objItem.OSLanguage, objItem.CurrentTimeZone,objItem.Locale,objItem.SerialNumber,objItem.SystemDrive,objItem.WindowsDirectory as well if require.
0
 
LVL 1

Author Comment

by:SAM2009
ID: 35204148
Thanks but Is it normal that I got:

Error: Permission denied:'GetObject'
0
 
LVL 65

Expert Comment

by:RobSampson
ID: 35204250
From the code I posted at
http://www.experts-exchange.com/Software/Server_Software/Email_Servers/Exchange/Q_26757481.html

which gets the information from the domain, you won't get that error, but from the code Anurag posted, you will get that if a machine from the text file is either offline, or WMI cannot be connected to on the remote machine.  There are ways around that for that script, but if you have AD, try the script I posted.

Regards,

Rob.
0
 
LVL 3

Expert Comment

by:Anurag_Tiwari
ID: 35204917
As above given script picking up the data from all the macine which would be actual data.You need to be carefull for below given things
1) You should have access rights on a machine against which you are running the script.It's would be better to run it through domain admin right.
2) It wouldn't pickup the data if a machine is offline.We can add error handling part in that so that it would give you the details why it's not picking up the data i.e. Machine offline or you don't have access to that machine.
Please let me know if i need to add that error handelling part
0
 
LVL 1

Author Closing Comment

by:SAM2009
ID: 35238042
Sorry for the delay and thank for your helps! With those info I will be able to do something with that. Thanks
0

Featured Post

10 Questions to Ask when Buying Backup Software

Choosing the right backup solution for your organization can be a daunting task. To make the selection process easier, ask solution providers these 10 key questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows the method of using the Resultant Set of Policy Tool to locate Group Policy that applies a particular setting.
Uncontrolled local administrators groups within any organization pose a huge security risk. Because these groups are locally managed it becomes difficult to audit and maintain them.
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.
Suggested Courses

636 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