Never Mind I figured it out. lol Below is the edited code.
CODE
strHost = "."
Const HKLM = &H80000002
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.CreateTextFile("software_simple.csv", True)
objTextFile.WriteLine "Program Name" & "," & "Installation date"
Set objReg = GetObject("winmgmts://" & strHost & "/root/default:StdRegProv")
Const strBaseKey = "Software\Microsoft\Windows\CurrentVersion\Uninstall\"
objReg.EnumKey HKLM, strBaseKey, arrSubKeys
For Each strSubKey In arrSubKeys
intRet = objReg.GetStringValue(HKLM, strBaseKey & strSubKey, "DisplayName", strValue)
If intRet <> 0 Then
intRet = objReg.GetStringValue(HKLM, strBaseKey & strSubKey, "QuietDisplayName", strValue)
End If
intRet1 = objReg.GetStringValue(HKLM, strBaseKey & strSubKey, "InstallDate", strValue2)
If (strValue <> "") and (intRet = 0) Then
objTextFile.WriteLine strValue & "," & strValue2
End If
Next
WScript.Echo "Done"
objTextFile.Close
I also wrote a more in depth version code below
CODE
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.CreateTextFile("software_ext.csv", True)
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colSoftware = objWMIService.ExecQuery ("SELECT * FROM Win32_Product")
objTextFile.WriteLine "Caption" & "," & _
"Description" & "," & "Identifying Number" & "," & _
"Install Date" & "," & "Install Location" & "," & _
"Install State" & "," & "Name" & "," & _
"Package Cache" & "," & "SKU Number" & "," & "Vendor" & "," _
& "Version"
For Each objSoftware in colSoftware
objTextFile.WriteLine objSoftware.Caption & "," & _
objSoftware.Description & "," & _
objSoftware.IdentifyingNumber & "," & _
objSoftware.InstallDate & "," & _
objSoftware.InstallLocation & "," & _
objSoftware.InstallState & "," & _
objSoftware.Name & "," & _
objSoftware.PackageCache & "," & _
objSoftware.SKUNumber & "," & _
objSoftware.Vendor & "," & _
objSoftware.Version
Next
WScript.Echo "Done"
objTextFile.Close