Saturday, May 14, 2016

Get System Properties of Remote machines from CSV



On error resume Next

Set WshNetwork = WScript.CreateObject("WScript.Network")
strFileName = "C:\" & WshNetwork.ComputerName & "_Software_Details.xls"
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set objfso = CreateObject("Scripting.FileSystemObject")
set sf = objfso.OpenTextFile("C:\" & WshNetwork.ComputerName & "_Software_Details.csv",2,True)
Set colSoftware = objWMIService.ExecQuery ("Select * from Win32_Product")'
Set colSettings = objWMIService.ExecQuery ("Select * from Win32_OperatingSystem")
'Software Information'
'sf.WriteLine("SOFTWARE LIST")
'sf.WriteLine("=============")
For Each objSoftware in colSoftware
sf.WriteLine(objSoftware.Caption)
Next


Wscript.sleep 30000

Dim objOutl
Set objOutl = CreateObject("Outlook.Application")
Set objMailItem = objOutl.CreateItem(olMailItem)
'comment the next line if you do not want to see the outlook window
objMailItem.Display
strEmailAddr  = "shankar.sahu@tcs.com"
objMailItem.Recipients.Add strEmailAddr
objMailItem.Body = "Details of Machines"
objMailItem.Subject = "Daily Report"
objMailItem.Attachments.Add "C:\" & WshNetwork.ComputerName & "_Software_Details.csv"
'objMailItem.Attachments.Add "C:\" & WshNetwork.ComputerName & "_Hardware_Details.xls"
objMailItem.Send
Set objMailItem = nothing
Set objOutl = nothing

No comments:

Post a Comment

Windows Server 2016 Key Features and License Prospects

If you are planning to move to Windows 2016 and looking for benefits, I have listed down below : Why Windows Server 2016? ·     ...