Link to home
Start Free TrialLog in
Avatar of John Anthony
John Anthony

asked on

need a VB script to get details of all software installed in a machine add/remove program. put that details in excel or csv then mail it

need a VB script to get details of all software installed in a machine add/remove program. put that details in excel or csv then mail it
SOLUTION
Avatar of Ryan Chong
Ryan Chong
Flag of Singapore image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of John Anthony
John Anthony

ASKER

thanks any vb script do we have
this vbscript code that found online is working fine for me.

you may need to customize it a little bit.

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.CreateTextFile("software.csv", True)

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
  & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colSoftware = objWMIService.ExecQuery _
  ("Select * from Win32_Product")

objTextFile.WriteLine "Caption" & vbtab & _
  "Description" & vbtab & "Identifying Number" & vbtab & _
  "Install Date" & vbtab & "Install Location" & vbtab & _
  "Install State" & vbtab & "Name" & vbtab & _ 
  "Package Cache" & vbtab & "SKU Number" & vbtab & "Vendor" & vbtab _
    & "Version" 

For Each objSoftware in colSoftware
  objTextFile.WriteLine objSoftware.Caption & vbtab & _
  objSoftware.Description & vbtab & _
  objSoftware.IdentifyingNumber & vbtab & _
  objSoftware.InstallDate2 & vbtab & _
  objSoftware.InstallLocation & vbtab & _
  objSoftware.InstallState & vbtab & _
  objSoftware.Name & vbtab & _
  objSoftware.PackageCache & vbtab & _
  objSoftware.SKUNumber & vbtab & _
  objSoftware.Vendor & vbtab & _
  objSoftware.Version
Next
objTextFile.Close

Open in new window

ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
thanks
so which solution are you using?
just found that I got a typo in my comment:

try not using Powershell to archive that? which is pretty easy

suppose to be:

"try using .." or "why not using .."
How to email the excel file form powershell

How to email the excel file form powershell

I would not want to discuss further since what you're asking is not really related to your original question, but in fact, it's pretty easy with Send-MailMessage method.

Send-MailMessage
https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/send-mailmessage?view=powershell-7