Board index » Visual Studio » HELP SOFTWARE INVENTORY SCRIPT
|
Sgt_Zeke
|
HELP SOFTWARE INVENTORY SCRIPT
Visual Studio188
Hi, I am new to this scripting thing, and I am sure this has been explored many a time, however I have not been able to find something that does exactly want I want I am currently writing a script to inventory all installed software that shows up in th e control panel (no matter what the method, windows installer or not). I have it creating a text file with all the output being piped to it. The only problem is that at the moment I have additional blank lines showing up in the outputted file. I dont want these additional blank lines, but just the lines with the information. Can someone out there be so kind, and help this poor soul ;) TIA Eric I have attached the script below Set objFSO = CreateObject("Scripting.FileSystemObject") ' Allows creation of Files Set objNetwork = CreateObject("Wscript.Network") ' Allows accessing network variables Const HKLM = &H80000002 'HKEY_LOCAL_MACHINE ' reg access strComputerName = objNetwork.ComputerName ' Store the computer names as a variable strComputer strPath = "c:\scripts\" ' Folder where the completed file will be saved ' Needs to be a local or UNC path ' Soft Inventory portion strComputer = "." ' strKey = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" strEntry1a = "DisplayName" strEntry1b = "QuietDisplayName" strEntry2 = "InstallDate" strEntry3 = "VersionMajor" strEntry4 = "VersionMinor" ' Inventory these keys ' <----- Actual Script strFullName = objFSO.BuildPath(strPath, strComputerName) Set objTextFile = objFSO.CreateTextFile(strFullName & ".tsv", True) ' Creates a TSV file with a file name of computer it is being run on objTextFile.WriteLine "Name" & vbtab & _ "Install Date" & vbtab & _ "Version" ' soft inventory portion Set objReg = GetObject("winmgmts://" & strComputer & "/root/default:StdRegProv") objReg.EnumKey HKLM, strKey, arrSubkeys For Each strSubkey In arrSubkeys intRet1 = objReg.GetStringValue(HKLM, strKey & strSubkey, strEntry1a, strValue1) If intRet1 <>0 Then objReg.GetStringValue HKLM, strKey & strSubkey, trEntry1b, strValue1 End If If strValue1 <>"" Then End If objReg.GetStringValue HKLM, strKey & strSubkey, strEntry2, strValue2 If strValue2 <>"" Then End If objReg.GetDWORDValue HKLM, strKey & strSubkey, strEntry3, intValue3 objReg.GetDWORDValue HKLM, strKey & strSubkey, strEntry4, intValue4 If intValue3 <>"" Then End If objTextFile.WriteLine strValue1 & vbtab & strValue2 & vbtab & intValue3 & "." & intValue4 Next objTextFile.Close WScript.Quit - |
