Sign in to follow this  
Followers 0
skewltek

Dell OMCI Functions

3 posts in this topic

Below are several functions I just got finished creating and testing for interfacing with the Dell OpenManage Client Instrumentation (OMCI). For my purposes I didn't need any error handling built in, but this should get anyone started who would like the ability to change Dell bios settings with AutoIT.

You will need to install the Dell OMCI package for this to work, which is free, from here.

;********************************************************************
;*** Function Name: OMCI_AdminPW
;*** Usage: OMCI_AdminPW ("Target", "Old Password", "New Password")
;***
;*** Notes: To apply to local computer use "." as target, to clear
;***        the admin password, set the new password as ""
;********************************************************************
Func OMCI_AdminPW ($strComputerName, $strOldPwd, $strNewPwd)
    $obj = ObjGet('WinMgmts:{impersonationLevel=impersonate}//'& $strComputerName & '/root/Dellomci:Dell_Configuration="Configuration"')
     
    $obj.Properties_.Item("Password").Value = $strOldPwd & ' ' & $strNewPwd
    $obj.Properties_.Item("PasswordEncrypted").Value = 0
    $obj.Put_()
EndFunc


;********************************************************************
;*** Function Name: OMCI_FlashBios
;*** Usage: OMCI_FlashBios ("Target", "HDR file location")
;***
;*** Notes: To apply to local computer use "." as target.
;***        To create the HDR file, download a standard Dell bios
;***        package and run it with the '-WriteHDRfile' argument
;********************************************************************
Func OMCI_FlashBios ($strComputerName, $strHDRFile)
    $strMethod = "FlashBios"
    $obj = ObjGet('WinMgmts:{impersonationLevel=impersonate}//' & $strComputerName & '/root/Dellomci:Dell_Configuration')
    
    $objMethod = $obj.Methods_($strMethod)
    $objInParam = $objMethod.inParameters.SpawnInstance_()
    $objInParam.sUrl = $strHDRFile
    $obj.ExecMethod_($strMethod, $objInParam)
EndFunc


;********************************************************************
;*** Function Name: OMCI_AssetTag
;*** Usage: OMCI_AssetTag ("Target", "Asset Tag")
;***
;*** Notes: To apply to local computer use "." as target
;********************************************************************
Func OMCI_AssetTag ($strComputerName, $strAssetTag)
    $col = ObjGet("WinMgmts:{impersonationLevel=impersonate}//" & $strComputerName & "/root/Dellomci")
    $colItems = $col.Execquery("SELECT * FROM Dell_SystemSummary")

    For $obj in $colItems
        $obj.Properties_.Item("AssetTag").Value = $strAssetTag
        $obj.Put_()
    Next
EndFunc


;********************************************************************
;*** Function Name: OMCI_OwnerTag
;*** Usage: OMCI_OwnerTag ("Target", "Owner Tag")
;***
;*** Notes: To apply to local computer use "." as target
;********************************************************************
Func OMCI_OwnerTag ($strComputerName, $strOwnerTag)
    $obj = ObjGet('WinMgmts:{impersonationLevel=impersonate}//'& $strComputerName & '/root/Dellomci:Dell_Configuration="Configuration"')
     
    $obj.Properties_.Item("PropertyOwnershipTag").Value = $strOwnerTag
    $obj.Put_()
EndFunc


;********************************************************************
;*** Function Name: OMCI_BootOnlyHD
;*** Usage: OMCI_BootOnlyHD ("Target")
;***
;*** Notes: To apply to local computer use "." as target, disables
;***        all boot devices except hard drives.
;********************************************************************
Func OMCI_BootOnlyHD ($strComputerName)

    $col = ObjGet("WinMgmts:{impersonationLevel=impersonate}//" & $strComputerName & "/root/Dellomci")
    
    For $i = 0 to 10
    $colItems = $col.Execquery('SELECT * FROM Dell_BootDeviceSequence WHERE DellInstanceID ="' & $i & '"')

        For $obj in $colItems
            if StringInStr ($obj.Properties_.Item("BootDeviceName").Value, "HDD") or StringInStr ($obj.Properties_.Item("BootDeviceName").Value, "Hard") Then
                $obj.Properties_.Item("Status").Value = 1
            Else
                $obj.Properties_.Item("Status").Value = 0
            EndIf
            $obj.Put_()
        Next
    Next
EndFunc


;********************************************************************
;*** Function Name: OMCI_Restart
;*** Usage: OMCI_Restart ("Target")
;***
;*** Notes: To apply to local computer use "." as target.
;***        Restarts the computer using OMCI call
;********************************************************************
Func OMCI_Restart ($strComputerName)
    $strMethod = "Restart"
    $obj = ObjGet('WinMgmts:{impersonationLevel=impersonate}//' & $strComputerName & '/root/Dellomci:Dell_Configuration')
    $obj.ExecMethod_($strMethod)
EndFunc


;********************************************************************
;*** Function Name: OMCI_Shutdown
;*** Usage: OMCI_Shutdown ("Target")
;***
;*** Notes: To apply to local computer use "." as target.
;***        Shuts down the computer using OMCI call
;********************************************************************
Func OMCI_Shutdown ($strComputerName)
    $strMethod = "Shutdown"
    $obj = ObjGet('WinMgmts:{impersonationLevel=impersonate}//' & $strComputerName & '/root/Dellomci:Dell_Configuration')
    $obj.ExecMethod_($strMethod)
EndFunc


;********************************************************************
;*** Function Name: OMCI_SetWOL
;*** Usage: OMCI_SetWOL ("Target")
;***
;*** Notes: To apply to local computer use "." as target, 
;***        Run this to turn on WOL for all NICs
;********************************************************************
Func OMCI_SetWOL ($strComputerName)
    $obj = ObjGet('WinMgmts:{impersonationLevel=impersonate}//'& $strComputerName & '/root/Dellomci:Dell_SMBIOSSettings="0"')

    $objValue = $obj.Properties_.Item("WakeupOnLan").Value
    If $objValue <> "6" then
        $obj.Properties_.Item("WakeupOnLan").Value = 6
        $obj.Put_()
    EndIf
EndFunc


;********************************************************************
;*** Function Name: OMCI_SetPXEonBoot
;*** Usage: OMCI_SetPXEonBoot ("Target")
;***
;*** Notes: To apply to local computer use "." as target, 
;***        Run this to turn on Boot w/PXE for next boot
;********************************************************************
Func OMCI_SetPXEonBoot ($strComputerName)
    $obj = ObjGet('WinMgmts:{impersonationLevel=impersonate}//'& $strComputerName & '/root/Dellomci:Dell_Configuration="Configuration"')

    $objValue = $obj.Properties_.Item("ForcePXEOnNextBoot").Value
    If $objValue <> "3" then
        $obj.Properties_.Item("ForcePXEOnNextBoot").Value = 3
        $obj.Put_()
    EndIf
EndFunc


;********************************************************************
;*** Function Name: OMCI_ResetChassisFlag
;*** Usage: OMCI_ResetChassisFlag ("Target")
;***
;*** Notes: To apply to local computer use "." as target, 
;***        Run this to reset the chassis intrusion alert
;********************************************************************
Func OMCI_ResetChassisFlag ($strComputerName)
    $obj = ObjGet('WinMgmts:{impersonationLevel=impersonate}//'& $strComputerName & '/root/Dellomci:Dell_SMBIOSSettings="0"')

    $objValue = $obj.Properties_.Item("ChassisIntrusionStatus").Value
    If $objValue = "3" then
        $obj.Properties_.Item("ChassisIntrusionStatus").Value = 5
        $obj.Put_()
    EndIf
EndFunc


;********************************************************************
;*** Function Name: OMCI_StopHDDalert
;*** Usage: OMCI_StopHDDalert ()
;***
;*** Notes: Stops the annoying alert stating that you are almost
;***        out of free space on your hard drive.
;********************************************************************
Func OMCI_StopHDDalert ()
    RegWrite ("HKEY_LOCAL_MACHINE\SOFTWARE\DELL\OpenManage\Client\SysInfo", "HDDThresholdValue", "REG_DWORD", "00000000")
EndFunc

Share this post


Link to post
Share on other sites



;********************************************************************
;*** Function Name: OMCI_AdminPW
;*** Usage: OMCI_AdminPW ("Target", "Old Password", "New Password")
;***
;*** Notes: To apply to local computer use "." as target, to clear
;***        the admin password, set the new password as ""
;********************************************************************
Func OMCI_AdminPW ($strComputerName, $strOldPwd, $strNewPwd)
    $obj = ObjGet('WinMgmts:{impersonationLevel=impersonate}//'& $strComputerName & '/root/Dellomci:Dell_Configuration="Configuration"')
     
    $obj.Properties_.Item("Password").Value = $strOldPwd & ' ' & $strNewPwd
    $obj.Properties_.Item("PasswordEncrypted").Value = 0
    $obj.Put_()
EndFunc

nice one!

any idea how to read the current password?

Share this post


Link to post
Share on other sites

No, I don't think so. I can see that there are some Password Verification methods available, but I can't seem to make them work. I was hoping that I could create some type of dictionary lookup verification loop, but no go.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0