UNSOLVED

ahwing

updated

12 years ago

A

ahwing

2 Posts

0

21993

December 16th, 2011 11:00

OMCI 8.0 can't activate TPM

Hi, I need some help on debugging my vbScript to activate/deactivate TPM using OMCI 8.0. I was able to enable/disable TPM using my other vbscript. However, I was not able to activate/deactivate the TPM. Here's my script:

strNameSpace = "root\dcim\sysman"
strComputerName = WScript.Arguments(0)
strClassName = "DCIM_BIOSEnumeration"
strKeyValue = "Root/MainSystemChassis/BIOSSetupParent/BiosSetupTPMACT"

'*** Retrieve the instance of DCIM_BIOSEnumeration class for the TPM
Set objInstance = GetObject("WinMgmts:{impersonationLevel=impersonate," &_
    "AuthenticationLevel=pktprivacy}\\" & strComputerName & "\" &_
    strNameSpace & ":" & strClassName & "=" & Chr(34) & strKeyValue & Chr(34))

'*** Value: 1   Description: Deactivate
'*** Value: 2   Description: Activate
If objInstance.CurrentValue(0) = 2 Then
 Wscript.Echo "TPM is currently activated already!"
Else
    Wscript.Echo "TPM is currently deactivated, activate it now!"
    strClassName = "DCIM_BIOSService"
    strAttributeName(0) = objInstance.AttributeName
    strAttributeValue(0) = "2"
    strAuthorizationToken = "myBiosAdminPwd"

    returnValue = 0
    '*** Retrieve the instance of DCIM_BIOSService class
    Set objWMIService = GetObject("WinMgmts:{impersonationLevel=impersonate," &_
   "AuthenticationLevel=pktprivacy}\\" & strComputerName & "\" & strNameSpace)
    Set ColSystem=objWMIService.execquery ("Select * from " & strClassName)

    For each objInstance in ColSystem   
        Set oInParams = objInstance.Methods_("SetBIOSAttributes").InParameters.SpawnInstance_
        oInParams.AttributeName = strAttributeName
        oInParams.AttributeValue = strAttributeValue
        oInParams.AuthorizationToken = strAuthorizationToken
        Set returnValue = objInstance.ExecMethod_("SetBIOSAttributes", oInParams)
        Exit For
    Next
End If