6 Replies Latest reply on Nov 3, 2014 12:12 PM by clum09

    Adding WMI node to Orion server

    clum09

      Hello,

       

      I used the sample script (CRUD.AddWMINode.ps1 with some editing to fix the hyphens in the script) from the Orion SDK v1.9 to add the WMI node to the Orion server.

       

      Everything else works fine, but the WMI credential was not added. I like to know when a new version of the Orion SDK will be available so that I can try again to see whether I can add the WMI credential during adding the node.

       

      Thank you in advance.

        • Re: Adding WMI node to Orion server
          tdanner

          Could you clarify what you mean by "the WMI credential was not added"? What did you observe and what did you expect?

            • Re: Adding WMI node to Orion server
              clum09

              tdanner,

               

              Thank you for the response.

               

              The section of code below is from the CRUD.AddWMINode.ps1 sample script that came with the SDK.

               

              #Creating the node

              $newNodeUri = New-SwisObject $swis -EntityType "Orion.Nodes" -Properties $newNodeProps

              $nodeProps = Get-SwisObject $swis -Uri $newNodeUri

               

              #Getting the Credential ID

              $credentialId = Get-SwisData $swis "SELECT ID FROM Orion.Credential where Name = '$credentialName'"

              if (!$credentialId) {

                  Throw "Can't find the Credential with the provided Credential name '$credentialName'."

              }

               

              #Adding NodeSettings

              $nodeSettings = @{

                  NodeID=$nodeProps["NodeID"];

                  SettingName="WMICredential";

                  SettingValue=($credentialId.ToString());

              }

               

              #Creating node settings

              $newNodeSettings = New-SwisObject $swis -EntityType "Orion.NodeSettings" -Properties $nodeSettings

               

              The $credentialIId variable above has a value of an array of numbers from the Get-SwisData cmdlet line above with the credential name that I supplied from the Manage Windows Credentials page of the Setting page of the Orion Console web page.

               

              After the line $newNodeSettings = New-SwisObject $swis -EntityType "Orion.NodeSettings" -Properties $nodeSettings has been executed and the script completed adding the pollers for the node, I went to view the WMI credential for the node on the console page. I selected the node that was just added on the Orion Summary Home tab and click on Edit node. Under the Polling Method section of the page, I should see the credential as shown below:

               

               

              Instead of seeing the credential as shown above, the lines Choose credential, Credential name, User name, Password, and Confirm password above are all blank. As a result, this node that I just added continues to have blank monitoring data until I manually open this page and manually add the credential and then the node will show the monitoring data.

               

              That is what I meant by not being able to add the WMI credential to the node using the PowerShell script.

                • Re: Adding WMI node to Orion server
                  tdanner

                  "The $credentialIId variable above has a value of an array of numbers"

                   

                  That would be a problem. There should be just one number. Try printing it out from the script and see what it looks like. If there's more than one credential with the same name, you would need to add "TOP 1" to the "SELECT ID FROM Orion.Credential ..." query or delete the redundant creds.

                    • Re: Adding WMI node to Orion server
                      clum09

                      tdanner,

                       

                      Thank you for the information.

                       

                      The $credentialId variable from the query has an array of number 8 and 9. When I selected the first one, it generated an error and it did not even let me open the Edit Node page on the Orion Console page. When I select the last one from the array, the WMI credential was added properly.

                       

                      I tried to determine which of the the numbers (8 or 9) that matches the credential name using the code below, but both of them match the credential name that I supplied from the Manage Windows Credentials page of the Setting page of the Orion Console web page.

                       

                      $credId = $credentialId.ToString()

                      Get-SwisData $swis "SELECT Name FROM Orion.Credential where ID = '$credId'"

                       

                      I checked the Manage Windows Credentials page of the Setting page of the Orion Console web page, and there is no identical credential name that was assigned.  I also tested the other credential names from the Manage Windows Credentials page, and some have two numbers and some of them have only one number.

                       

                      If the credential name have two numbers as the credential ID, is it always the last number of the list that I should use?