Right now this VBS queries the WMI for specific details such as MAke, model, serial number. Then puts them into specific registry key locations.
right now it runs against the local machine that it runs on. How could this be updated to loop thru a text file and run against remote machines. If i wanted to take around 1000 machines from active directory put them in a text file and have the below script run against them one time
'**************************************************************
'* VBScript to create custom registry key for ePO
'* Author:
'* Company: XXXXX
'* Usage: wscript ePO_customkeys.vbs
'*
'* Date: Comments
'*=============================================================
'* 07/14/2014 Created
'* 07/15/2014 Updated variables - Stretch
'**************************************************************
On error resume next
'**************************************************************
'* Global Variables
'**************************************************************
const HOSTNAME_NAME = "." 'declar rmote computer name; use . for local PC
const HKEY_LOCAL_MACHINE = &H80000002
const REG_KEY_PATH = "SOFTWARE\Network Associates\ePolicy Orchestrator\Agent\CustomProps"
Dim objManufacturer, objModel, objSerial
'retrieve model
Set objWMIService = GetObject("winmgmts:\\" & HOSTNAME_NAME & "\root\CIMV2")
Set colItems = objWMIService.ExecQuery( "SELECT * FROM Win32_ComputerSystem",,48)
For Each objItem in colItems
objModel = Trim(objItem.Model)
Next
'retrieve computer manufacturer, serial
Set objWMIService = GetObject("winmgmts:\\" & HOSTNAME_NAME & "\root\CIMV2")
Set colItems = objWMIService.ExecQuery( "SELECT * FROM Win32_BIOS",,48)
For Each objItem in colItems
objManufacturer = Trim(objItem.Manufacturer)
objSerial = Trim(objItem.SerialNumber)
Next
'add registry
'Set StdOut = WScript.StdOut
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & HOSTNAME_NAME & "\root\default:StdRegProv")
'create registry key
oReg.CreateKey HKEY_LOCAL_MACHINE,REG_KEY_PATH
oReg.SetStringValue HKEY_LOCAL_MACHINE,REG_KEY_PATH,"CustomProps1",objManufacturer
oReg.SetStringValue HKEY_LOCAL_MACHINE,REG_KEY_PATH,"CustomProps2",objModel
oReg.SetStringValue HKEY_LOCAL_MACHINE,REG_KEY_PATH,"CustomProps3",objSerial
'**************************************************************
'* Additional debugging scripts
'* COMMENT THEM OUT ON PRODUCTION
'**************************************************************
'WScript.Echo "Manufacturer: " & objManufacturer & ", Model: " & objModel & ", Serial: " & objSerial
'delete key
'oReg.DeleteKey HKEY_LOCAL_MACHINE, REG_KEY_PATH
WScript.Quit
A simple search in SO will give you the part you need. First you need to read a file and loop through it line be line.
Convert the greater portion of your script into a
Sub
calledProcessServer
Warning
For brevity I made no effort to declare my variables or do simple error checking like file exists. Again, some simple searching can help you with those issues which i highly recommend you address.