Tech Support Guy banner

VB scripting question

5607 Views 34 Replies 5 Participants Last post by  IBGhost
Hello, Hopefully this will be pretty easy. I found some script on Microsoft site that will help gather computer infomation. What i would like to do is have the scripts put the information into a excel spreadsheet or something. Right now, the scripts are echoing the info on the screen. Which is fine but i need to run this on several computers and need to be able to view the info later. Any help would be great. thanks
Status
Not open for further replies.
1 - 9 of 35 Posts
How can you change this code to give you the computer name too?
Ok ! can you explain a little more how do add your code to my code?
This is my code:
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 objReg = GetObject("winmgmts://" & strComputer & _
"/root/default:StdRegProv")
objReg.EnumKey HKLM, strKey, arrSubkeys
WScript.Echo "Installed Applications" & VbCrLf
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
WScript.Echo VbCrLf & "Display Name: " & strValue1
End If
objReg.GetStringValue HKLM, strKey & strSubkey, _
strEntry2, strValue2
If strValue2 <> "" Then
WScript.Echo "Install Date: " & strValue2
End If
objReg.GetDWORDValue HKLM, strKey & strSubkey, _
strEntry3, intValue3
objReg.GetDWORDValue HKLM, strKey & strSubkey, _
strEntry4, intValue4
If intValue3 <> "" Then
WScript.Echo "Version: " & intValue3 & "." & intValue4
End If
objReg.GetDWORDValue HKLM, strKey & strSubkey, _
strEntry5, intValue5
If intValue5 <> "" Then
WScript.Echo "Estimated Size: " & Round(intValue5/1024, 3) & " megabytes"
End If
Next

I will like when I run the script to give the computername and to save on the network drive.
Thank for help me!
See less See more
yes when I run the code to give me the output in excel and to be save on the network drive.
What i am trying to do is when I run the script to give the the name or asset number of the computer and the software on excel sheet on the E drive, which is a network drive.
I still have problem when I run the programm it give syntax error,line58 and char79
Thank you! it work fine now. But I want to ask you one more question when I try to put to another comp is not working?
The file name or path name does not exist
The file you are trying to open is being used by another prog.Close the document in the other program and try again
The name of the workbook yo are trying to save is the same of another doc that is read-only
code;800A03EC
source: Microsoft Excel
line 67
char1
this is the error
1 - 9 of 35 Posts
Status
Not open for further replies.
Top