Ashish's Note

Over the past few years, I learnt a lot and get fond of Microsoft Technlogy. From The basics of Active Directory to the high end troubleshooting and disaster recovery, to the VPN configuration, Its being a good time for me as I got lots of opportunities to learn and grow.

In 2004, I got hired by "Microsoft" as a full time employee in its GTSC located in Bangalore. I experienced hardcore troubleshooting on real time issues as a big challange and very very intersting, which gave me vibrant knowledge of Operating System Troubleshooting, Active Directory, Clustering, Performance, Disks, Terminal Server, Printing, STOP Codes and BSOD screens.

My Fantastic past experience on HP/MSCS cluster, Server Hardware and System Administration, boosted my skills to take charge of customer's problem and make me to deal with the issues till the resolution.


Today working with Perot Systems, I am using this Blog to contribute my knowledge to the society and to make every individual who need directives to grow in IT field.

Lets post your views and questions you have, hit my brain to let it mentor the best possible IT solutions and career options.

Yours,

Ashish Sharma.

Sunday, April 27, 2008

Script for Windows System Information

Last week for a small project to pull system info from 500 server, I used the following vbs script (found on google search as I not good in writing scripts) to pull WMI info for OS version, SP, Processor, Memory:

On Error Resume Next
Const ForReading = 1
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile("c:\computers.txt", ForReading) 'Check the location of the file.
strComputers = objTextFile.ReadAll
objTextFile.Close
arrComputers = Split(strComputers, vbCrLf)
Set objShell = CreateObject("WScript.Shell")
For Each strComputer In arrComputers
strComputer = arrComputers
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colSettings = objWMIService.ExecQuery _
("SELECT * FROM Win32_OperatingSystem")
For Each objOperatingSystem in colSettings
Wscript.Echo "OS Name: " & objOperatingSystem.Name
Wscript.Echo "Version: " & objOperatingSystem.Version
Wscript.Echo "Service Pack: " & _
objOperatingSystem.ServicePackMajorVersion _
& "." & objOperatingSystem.ServicePackMinorVersion
Wscript.Echo "OS Manufacturer: " & objOperatingSystem.Manufacturer
Wscript.Echo "Windows Directory: " & _
objOperatingSystem.WindowsDirectory
Wscript.Echo "Locale: " & objOperatingSystem.Locale
Wscript.Echo "Available Physical Memory: " & _
objOperatingSystem.FreePhysicalMemory
Wscript.Echo "Total Virtual Memory: " & _
objOperatingSystem.TotalVirtualMemorySize
Wscript.Echo "Available Virtual Memory: " & _
objOperatingSystem.FreeVirtualMemory
Wscript.Echo "OS Name: " & objOperatingSystem.SizeStoredInPagingFiles
Next
Set colSettings = objWMIService.ExecQuery _
("SELECT * FROM Win32_ComputerSystem")
For Each objComputer in colSettings
Wscript.Echo "System Name: " & objComputer.Name
Wscript.Echo "System Manufacturer: " & objComputer.Manufacturer
Wscript.Echo "System Model: " & objComputer.Model
Wscript.Echo "Time Zone: " & objComputer.CurrentTimeZone
Wscript.Echo "Total Physical Memory: " & _
objComputer.TotalPhysicalMemory
Next
Set colSettings = objWMIService.ExecQuery _
("SELECT * FROM Win32_Processor")
For Each objProcessor in colSettings
Wscript.Echo "System Type: " & objProcessor.Architecture
Wscript.Echo "Processor: " & objProcessor.Description
Next
Set colSettings = objWMIService.ExecQuery _
("SELECT * FROM Win32_BIOS")
For Each objBIOS in colSettings
Wscript.Echo "BIOS Version: " & objBIOS.Version
Next
Next

Its a nice one to solve my purpose!!

0 comments: