I began scripting a couple of months ago and wrote this script to inventory the version of norton installed on client computers. In my enviroment I simply export the computer accounts to a text file and run this script. As I get better with vbscript I’ll be able to connect directly to AD. It could use some comments which I’ll add later. Hope this helps someone.
const HKEY_LOCAL_MACHINE = &H80000002
Set WshShell = CreateObject(”wscript.Shell”)
Set ObjFso = CreateObject(”scripting.filesystemobject”)
‘Open Text File to read
‘Create Report
Set objTSIn = objFSO.OpenTextFile(”C:\Temp\ListOfComputers.txt”)
Set objTSOut = objFSO.CreateTextFile(”C:\Temp\Inventory.csv”,2, True)
objTSOut.Write(”ComputerName” & vbtab & “Norton Version” & vbTab & “OS” & vbcr)
‘Start Loop
Do While Not objTSIn.AtEndOfStream
On Error Resume next
strComputer = objTSIn.ReadLine
Set objWshScriptExec = WshShell.Exec(”%comspec% /c ping -n 3 -w 1000 ” & strComputer)
Set objStdOut = objWshScriptExec.StdOut
strText = objStdOut.ReadAll
If Instr(strText, “Reply”) > 0 Then
Set objReg=GetObject(”winmgmts:{impersonationLevel=impersonate}!\\”& strComputer & “\root\default:StdRegProv”)
strKeyPath = “Software\Microsoft\Windows\CurrentVersion\Uninstall”
objReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys
For Each subkey In arrSubKeys
Select Case Subkey
Case “{BD12EB47-DBDF-11D3-BEEA-00A0CC272509}” ‘7.6
objTSOut.Write(strComputer & Vbtab & “Nav 7.x” & vbCr)
Case “{0EFC6259-3AD8-4CD2-BC57-D4937AF5CC0E}” ‘8.x
objTSOut.Write(strComputer & vbtab & “Nav 8.x” & vbCr)
Case “{848AC794-8B81-440A-81AE-6474337DB527}” ‘9.x
objTSOut.Write(strComputer & vbtab & “Nav 9.x” & vbCr)
Case “{5A633ED0-E5D7-4D65-AB8D-53ED43510284}” ‘10.0.359.0
objTSOut.Write(strComputer & vbtab & “Nav 10.0.359.0″ & vbCr)
Case “{1BA1A958-4BBB-4AB1-9B66-C86CEC6616CB}” ‘10.0.846.0
objTSOut.Write(strComputer & vbtab & “10.0.846.0″ & vbCr)
Case “{A011A1DC-7F1D-4EA8-BD11-0C5F9718E428}” ‘10.1.0.396
objTSOut.Write(strComputer & vbTab & “10.1.0.396″ & vbCr)
Case “{50E125D1-88E5-48CE-80AE-98EC9698E639}” ‘10.1.6.6000
objTSOut.Write(strComputer & vbtab & “10.1.6.6000″ & vbCr)
Case “{7C9E6E52-EB11-44DB-A761-82D5D873A8D9}” ‘10.2.0.276
objTSOut.Write(strComputer & vbTab & “10.2.0.276″ & vbCr)
Case “{33CFCF98-F8D6-4549-B469-6F4295676D83}” ‘10.1.5000.5
objTSOut.Write(strComputer & vbTab & “10.1.5000.5″ & vbCr)
End Select
Next
Else
Set objLogOut = objFSO.CreateTextFile(”c:\Temp\NavProject\log.txt”,2, True)
objLogOut.Write(”Connection failed on: ” & strComputer & ” on ” & Now & vbCrLf)
End If
Loop ‘End Loop
WScript.Echo “Script Done!”
0 Responses to “Norton Inventory VBScript”