
UNSOLVED
Need OMCI 8 Asset Tag Script Help
I'm trying to create a vb script to update asset tag info. The only ones I can find are for OMCI 7 and older. I took a stab at updating one of the posted scripts but can't seem to make it work. From what I can see there is a ChangeAssetTag method under DCIM_Chassis but I can figure out how to make it work. Here's a condensed version of what I've got so far...
Option Explicit
'*** Declare variables
Dim strNameSpace
Dim strComputerName
Dim strClassName
Dim objInstance
Dim strNewValue(2)
Dim strTimeoutPeriod(2)
Dim strAuthorizationToken
Dim returnValue
Dim objWMIService
Dim ColSystem
Dim oInParams
'*** Initialize variables
strNameSpace = "root/dcim/sysman"
strComputerName = "."
strClassName = "DCIM_Chassis"
strNewValue(0) = WScript.Arguments(0)
strTimeoutPeriod(0) = "60"
strAuthorizationToken = ""
returnValue = 0
'*** Retrieve the instance of DCIM_Chassis class
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate," &_
"AuthenticationLevel=pktprivacy}\\" & strComputerName & "\" &_
strNameSpace)
Set ColSystem=objWMIService.execquery ("Select * from " & strClassName)
For each objInstance in ColSystem
WScript.Echo "ChassisAssetTag: " & objInstance.ElementName
Set oInParams = objInstance.Methods_("ChangeAssetTag").InParameters.SpawnInstance_
oInParams.NewValue = strNewValue
oInParams.AuthorizationToken = strAuthorizationToken
'oInParams.TimeoutPeriod = strTimeoutPeriod
Set returnValue = objInstance.ExecMethod_("ChangeAssetTag", oInParams)
Next
Option Explicit
'*** Declare variables
Dim strNameSpace
Dim strComputerName
Dim strClassName
Dim objInstance
Dim strNewValue(2)
Dim strTimeoutPeriod(2)
Dim strAuthorizationToken
Dim returnValue
Dim objWMIService
Dim ColSystem
Dim oInParams
'*** Initialize variables
strNameSpace = "root/dcim/sysman"
strComputerName = "."
strClassName = "DCIM_Chassis"
strNewValue(0) = WScript.Arguments(0)
strTimeoutPeriod(0) = "60"
strAuthorizationToken = ""
returnValue = 0
'*** Retrieve the instance of DCIM_Chassis class
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate," &_
"AuthenticationLevel=pktprivacy}\\" & strComputerName & "\" &_
strNameSpace)
Set ColSystem=objWMIService.execquery ("Select * from " & strClassName)
For each objInstance in ColSystem
WScript.Echo "ChassisAssetTag: " & objInstance.ElementName
Set oInParams = objInstance.Methods_("ChangeAssetTag").InParameters.SpawnInstance_
oInParams.NewValue = strNewValue
oInParams.AuthorizationToken = strAuthorizationToken
'oInParams.TimeoutPeriod = strTimeoutPeriod
Set returnValue = objInstance.ExecMethod_("ChangeAssetTag", oInParams)
Next
Responses (0)
Solutions (0)
