Can you post your existing script for us to see?
Rollin
Rollin
Dim objExcel
Dim objWorkBook
Dim vLastRow
Const HKLM = &H80000002 'HKEY_LOCAL_MACHINE
strComputer = "."
strKey = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"
strEntry1a = "DisplayName"
strEntry1b = "QuietDisplayName"
strEntry2 = "InstallDate"
strEntry3 = "VersionMajor"
strEntry4 = "VersionMinor"
strEntry5 = "EstimatedSize"
Set objExcel = CreateObject("EXCEL.APPLICATION")
objExcel.Visible = True
Set objWorkbook = objExcel.Workbooks.Add()
objWorkbook.ActiveSheet.Range("A1").Value = "DisplayName"
objWorkbook.ActiveSheet.Range("B1").Value = "InstallDate"
objWorkbook.ActiveSheet.Range("C1").Value = "VersionMajor"
objWorkbook.ActiveSheet.Range("D1").Value = "EstimatedSize"
vLastRow = objWorkbook.Activesheet.UsedRange.Rows.Count + 1
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, _
strEntry1b, strValue1
End If
If strValue1 <> "" Then
objWorkbook.ActiveSheet.Range("A" & vLastRow).Value = strValue1
End If
objReg.GetStringValue HKLM, strKey & strSubkey, _
strEntry2, strValue2
If strValue2 <> "" Then
objWorkbook.ActiveSheet.Range("B" & vLastRow).Value = strValue2
End If
objReg.GetDWORDValue HKLM, strKey & strSubkey, _
strEntry3, intValue3
objReg.GetDWORDValue HKLM, strKey & strSubkey, _
strEntry4, intValue4
If intValue3 <> "" Then
objWorkbook.ActiveSheet.Range("C" & vLastRow).Value = intValue4
End If
objReg.GetDWORDValue HKLM, strKey & strSubkey, _
strEntry5, intValue5
If intValue5 <> "" Then
objWorkbook.ActiveSheet.Range("D" & vLastRow).Value = Round(intValue5/1024, 3) & " megabytes"
End If
vLastRow = objWorkbook.Activesheet.UsedRange.Rows.Count + 1
Next
objWorkbook.SaveAs ("C:\TEST.xls")
Set objExcel = CreateObject("EXCEL.APPLICATION")
'code
'code
Next
objExcel.Visible = True
Set objExcel = CreateObject("EXCEL.APPLICATION")
objExcel.Visible = True
objExcel.ScreenUpdating = False
'code
'code
Next
objExcel.ScreenUpdating = True
Private Declare Function apiGetComputerName Lib "kernel32" Alias _
"GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Function funcCompName() As String
Dim lngLen As Long, lngX As Long
Dim strCompName As String
lngLen = 16
strCompName = String$(lngLen, 0)
lngX = apiGetComputerName(strCompName, lngLen)
If lngX <> 0 Then
funcCompName = Left$(strCompName, lngLen)
End If
End Function
Public Sub GetName()
strCompName = funcCompName
MsgBox (strCompName)
End Sub
Private Declare Function apiGetComputerName Lib "kernel32" Alias _
"GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Function funcCompName() As String
Dim lngLen As Long, lngX As Long
Dim strCompName As String
lngLen = 16
strCompName = String$(lngLen, 0)
lngX = apiGetComputerName(strCompName, lngLen)
If lngX <> 0 Then
funcCompName = Left$(strCompName, lngLen)
End If
End Function
strCompName = funcCompName
MsgBox (strCompName)
Dim objNetwork
Set objNetwork = CreateObject("WScript.NetWork")
Dim strComputer
strComputer = objNetwork.ComputerName
MsgBox strComputer
Set objNetwork = Nothing
Dim objExcel
Dim objWorkBook
Dim vLastRow
Dim objNetwork
Dim strComputerName
Set objNetwork = CreateObject("WScript.NetWork")
strComputerName = objNetwork.ComputerName
Const HKLM = &H80000002 'HKEY_LOCAL_MACHINE
strComputer = "."
strKey = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"
strEntry1a = "DisplayName"
strEntry1b = "QuietDisplayName"
strEntry2 = "InstallDate"
strEntry3 = "VersionMajor"
strEntry4 = "VersionMinor"
strEntry5 = "EstimatedSize"
Set objExcel = CreateObject("EXCEL.APPLICATION")
Set objWorkbook = objExcel.Workbooks.Add()
objWorkbook.activesheet.Range("A1").value = strComputerName
objWorkbook.ActiveSheet.Range("A2").Value = "DisplayName"
objWorkbook.ActiveSheet.Range("B2").Value = "InstallDate"
objWorkbook.ActiveSheet.Range("C2").Value = "VersionMajor"
objWorkbook.ActiveSheet.Range("D2").Value = "EstimatedSize"
vLastRow = objWorkbook.Activesheet.UsedRange.Rows.Count + 1
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, _
strEntry1b, strValue1
End If
If strValue1 <> "" Then
objWorkbook.ActiveSheet.Range("A" & vLastRow).Value = strValue1
End If
objReg.GetStringValue HKLM, strKey & strSubkey, _
strEntry2, strValue2
If strValue2 <> "" Then
objWorkbook.ActiveSheet.Range("B" & vLastRow).Value = strValue2
End If
objReg.GetDWORDValue HKLM, strKey & strSubkey, _
strEntry3, intValue3
objReg.GetDWORDValue HKLM, strKey & strSubkey, _
strEntry4, intValue4
If intValue3 <> "" Then
objWorkbook.ActiveSheet.Range("C" & vLastRow).Value = intValue4
End If
objReg.GetDWORDValue HKLM, strKey & strSubkey, _
strEntry5, intValue5
If intValue5 <> "" Then
objWorkbook.ActiveSheet.Range("D" & vLastRow).Value = Round(intValue5/1024, 3) & " megabytes"
End If
vLastRow = objWorkbook.Activesheet.UsedRange.Rows.Count + 1
Next
vPath = "E:\" & strComputerName & ".xls"
objWorkbook.SaveAs(vPath)
objWorkbook.Close
Set objExcel = Nothing
Set objWorkbook = Nothing
Set objNetwork = Nothing
Set objReg = Nothing
Msgbox("Complete")