9 Replies Latest reply on Apr 4, 2011 2:21 PM by scriptmonger

    sbadmcl equivalent for "Reset All to Group Configuration"

      Hello all,


      We are running a Safeboot environment using version 5.1.8 of the EEPC manager.  I'm currently looking for a way to apply the group configuration to all machine objects currently in that group using the sbadmcl.exe command-line utility.  Basically, I need to "Reset All to Group Configuration" without using the GUI.


      I discovered the "SetGroupConfig" command:


      SbAdmCl.exe -command:SetGroupConfig -adminuser:[user] -adminpwd:[pwd] -Group:"Group Name"


      While the command reported as successful, it completed far too quickly to have actually worked.


      Can someone advise me?

        • 1. Re: sbadmcl equivalent for "Reset All to Group Configuration"

          wrong command - that one sets the group configuration to controlled or not - try adding "-help" to the command line to see the parameters. The command is also documented in the Scripting Tools guide.


          You need setmachineconfigtogroup - make sure you read the help and manual before using it though so you know what the effects are going to be!

          • 2. Re: sbadmcl equivalent for "Reset All to Group Configuration"

            Thanks very much.


            Any particular reason that all the examples in the guide are in XML rather than console command syntax?

            • 3. Re: sbadmcl equivalent for "Reset All to Group Configuration"

              because we'd rather you use the COM object than a command prompt - it's a little more "this century" :-)


              I don't think you'd actually need an example for a command line though - you can use the "-help" tag to work it out.

              • 4. Re: sbadmcl equivalent for "Reset All to Group Configuration"

                Do you know if there are any code samples out there for using the COM object in C# ?

                • 5. Re: sbadmcl equivalent for "Reset All to Group Configuration"

                  not that I know of - it's not a language we use much. VBS sure, but not C#

                  • 6. Re: sbadmcl equivalent for "Reset All to Group Configuration"

                    I know this is an old post, but I have a bit of an issue with the XML syntax for the sbadmclSetMachineConfigToGroup command. I am trying to figure out what the exact code should be to allow me to Exclude Users when using this command with the COM object in VBS. Below you will find my code contained between the lines of + signs:


                    ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++

                    '=============================================================================== =========
                    Function sbadmclSetMachineConfigToGroup
                    'Sets a machine to the default configuration of the group.
                    writeDebug 2,"Running sbadmclSetMachineConfigToGroup ("& myMachineName & "/" & DefaultMachineGroupName & ")..."
                    If SBADMConnectXML="" Or MyAdminUser="" Or MyAdminAuth="" Then writeDebug 0,"Incorrect Params!":CleanUp
                    '=============================================================================== =========
                         Dim xmldom,command,strText,comResult,conResult,ResultCode,ResultDescription
                         Set xmldom = CreateObject("Microsoft.XMLDOM")
                         'use connection default XML structure
                         strText = ""
                         If xmldom.parseError.errorCode = 0 Then
                              Set command = xmldom.selectSingleNode("SafeBoot/SbAdminScripting/SbAdminCommand")
                              command.selectSingleNode("Command").text = "SetMachineConfigToGroup"
                              command.selectSingleNode("Group").text = DefaultMachineGroupName
                              command.selectSingleNode("ExcludeUsers").text = "No"
                              command.selectSingleNode("Machine").text = myMachineName
                              strText = sbadmclExecuteCommand(xmldom,0)
                              ' Display the XML parse error
                              writeDebug 0,"XML Parse Error"
                              writeDebug 0, "Result code:" & xmldom.parseError.errorCode & vbcrlf & "Line: " & xmldom.parseError.Line & "Data: " & xmldom.parseError.srcText & "Reason: " & xmldom.parseError.reason
                         End If

                         if xmldom.parseError.errorCode= 0 then
                              'parse the command result
                              Set ComResult=xmldom.selectSingleNode("SafeBoot/SbAdminScripting/SbAdminCommandResu lt")
                              set ResultCode=ComResult.selectSingleNode("ResultCode")
                              set ResultDescription=ComResult.selectSingleNode("ResultDescription")
                              If debugLevel >=4 Or ResultCode.text <>SBADMCL_SUCCESS Then
                                   writeDebug 4,"....Captured Command Result Description: " & ResultDescription.text
                                   writeDebug 2,"....Captured Command Result Code: " & ResultCode.text
                              End If
                              If resultcode.text <> SBADMCL_SUCCESS Then
                                   'could not configure machine to group

                                   writeDebug 2,"Failed sbadmclSetMachineConfigToGroup for " & mymachinename & " because " & resultdescription.text
                              End If
                              If resultcode.text= SBADMCL_SUCCESS Then
                                    'sbadmclSetMachineConfigToGroup active was fine
                                   writeDebug 2,"sbadmclSetMachineConfigToGroup passed for machine " & myMachineName
                              End If
                                   writeDebug 4, ResultCode.text& " | " & ResultDescription.text
                                    ' Display the XML parse error
                                   MyOutPut "Bold", "XML Parse Error"
                                   MyOutPut "Bold", "Result code:" & xmldom.parseError.errorCode & vbcrlf & "Line: " & xmldom.parseError.Line & vbcrlf & "Data: " & xmldom.parseError.srcText & vbcrlf & "Reason: " & xmldom.parseError.reason
                              End If
                    End Function




                    I get an error when I call this function stating that an object is required on the line containing the following code:


                              command.selectSingleNode("ExcludeUsers").text = "No"


                    I am guessing this is a pretty simple issue to solve, I am just not finding the correct node name anywhere...


                    Thanks in advance!!


                    Message was edited by: scriptmonger on 4/4/11 1:49:59 PM CDT
                    • 7. Re: sbadmcl equivalent for "Reset All to Group Configuration"

                      hey, I recognise that sloppy coding style!


                      No, seriously, have you actually got an ExcludeUsers tag in the SBADMconnectXML string? That's the most logical explanation. You need to add




                      within the command parameters block if not.

                      • 8. Re: sbadmcl equivalent for "Reset All to Group Configuration"

                        Thanks Simon.  Your coding is excellent.  We're trying to tweak it some to maximize some automation during the install of the client s/w.

                        • 9. Re: sbadmcl equivalent for "Reset All to Group Configuration"

                          I am ecstatic that you responded so quickly...amazing...works perfectly!!! Thanks again!!