21 Replies Latest reply on May 23, 2017 2:41 PM by tdanner

    API Network Discovery

    nick_scott

      Following the instructions on GitHub (Discovery · solarwinds/OrionSDK Wiki · GitHub ) I am attempting to create a very basic network scan where IP address's between 10.X.0.1-10.X.31.254 are scanned with the credential ID's provided.   I am assuming the 3 separate plugin configuration are all actually part of the same script ?  Assuming this is correct, when I run the script now, the system is expecting an argument at the line below

       

      #Error expecting argument

      PS C:\Users\nsd000.QACMA> C:\Users\nsd000.QACMA\Documents\PowerShell Scripts\Do not Modify\Discovery.ps1

       

      cmdlet Invoke-SwisVerb at command pipeline position 1

       

      Supply values for the following parameters:

       

      Arguments[0]:

       

      Invoke-SwisVerb : Verb Orion.NPM.Interfaces.CreateInterfacesPluginConfiguration requires 1 parameters not 0

       

      At C:\Discovery.ps1:73 char:34

       

      + $InterfacesPluginConfiguration = Invoke-SwisVerb $swis Orion.NPM.Interfaces Crea ...

       

      +                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

       

          + CategoryInfo          : InvalidOperation: (:) [Invoke-SwisVerb], FaultException`1

       

          + FullyQualifiedErrorId : SwisError,SwisPowerShell.InvokeSwisVerb

       

       

       

      #The error above is referencing the line directly below

      $InterfacesPluginConfiguration = Invoke-SwisVerb $swis Orion.NPM.Interfaces CreateInterfacesPluginConfiguration

       

      #Complete Script Below, Everything above this line is describing the problem

      #CONNECTION TO SWIS

      $ErrorActionPreference = 'Stop'

      #Add the snapin
      Add-PSSnapin SwisSnapin

      #create a connection to solarwinds

      $hostname = 'X.X.X.X'
      $username = 'X'
      $password = 'X'

      #swis = Connect-Swis -Hostanme $hostname -Trusted
      $swis = Connect-Swis -Hostname $hostname -Username $username -Password $password

       

       

      #Core Plugin Configuration

      $CorePluginConfigurationContext = ([xml]"
      <CorePluginConfigurationContext xmlns='http://schemas.solarwinds.com/2012/Orion/Core' xmlns:i='http://www.w3.org/2001/XMLSchema-instance'>
              <IpAddressRange>
                  <StartAddress>10.X.0.1</StartAddress>
                  <EndAddress>10.X.31.254</EndAddress>
              </IpAddressRange>
          <Credentials>
              <SharedCredentialInfo>
                  <CredentialID></CredentialID>
                  <CredentialID>1</CredentialID>
               <CredentialID>2</CredentialID>
               <CredentialID>11</CredentialID>
                  <CredentialID>13</CredentialID>
                  <CredentialID>20</CredentialID>
                  <CredentialID>21</CredentialID>
               <CredentialID>47</CredentialID>
               <CredentialID>71</CredentialID>
                  <CredentialID>89</CredentialID>
                  <CredentialID>110</CredentialID>
                  <CredentialID>156</CredentialID>
                  <CredentialID>163</CredentialID>
                  <CredentialID>170</CredentialID>
               <CredentialID>197</CredentialID>
                  <CredentialID>198</CredentialID>
                  <CredentialID>202</CredentialID>
                  <Order>1</Order>
              </SharedCredentialInfo>
          </Credentials>
          <WmiRetriesCount>1</WmiRetriesCount>
          <WmiRetryIntervalMiliseconds>1000</WmiRetryIntervalMiliseconds>
      </CorePluginConfigurationContext>
      ").DocumentElement

       

      #Interface Plugin Configuration

      $CorePluginConfiguration = Invoke-SwisVerb $swis Orion.Discovery CreateCorePluginConfiguration @($CorePluginConfigurationContext

      $InterfacesPluginConfigurationContext = ([xml]"
      <InterfacesDiscoveryPluginContext xmlns='http://schemas.solarwinds.com/2008/Interfaces'
                                        xmlns:a='http://schemas.microsoft.com/2003/10/Serialization/Arrays'>
          <AutoImportStatus>
              <a:string>Up</a:string>
              <a:string>Down</a:string>
              <a:string>Shutdown</a:string>
          </AutoImportStatus>
          <AutoImportVirtualTypes>
              <a:string>Virtual</a:string>
              <a:string>Physical</a:string>
          </AutoImportVirtualTypes>
          <AutoImportVlanPortTypes>
              <a:string>Trunk</a:string>
              <a:string>Access</a:string>
              <a:string>Unknown</a:string>
          </AutoImportVlanPortTypes>
          <UseDefaults>false</UseDefaults>
      </InterfacesDiscoveryPluginContext>
      ").DocumentElement

      $InterfacesPluginConfiguration = Invoke-SwisVerb $swis Orion.NPM.Interfaces CreateInterfacesPluginConfiguration

       

      #Discovery Plugin Configuration

      $EngineID = 1
      $DeleteProfileAfterDiscoveryCompletes = "false"

      $StartDiscoveryContext = ([xml]"
      <StartDiscoveryContext xmlns='http://schemas.solarwinds.com/2012/Orion/Core' xmlns:i='http://www.w3.org/2001/XMLSchema-instance'>
          <Name>Script Discovery $([DateTime]::Now)</Name>
          <EngineId>$EngineID</EngineId>
          <JobTimeoutSeconds>3600</JobTimeoutSeconds>
          <SearchTimeoutMiliseconds>2000</SearchTimeoutMiliseconds>
          <SnmpTimeoutMiliseconds>2000</SnmpTimeoutMiliseconds>
          <SnmpRetries>1</SnmpRetries>
          <RepeatIntervalMiliseconds>1500</RepeatIntervalMiliseconds>
          <SnmpPort>161</SnmpPort>
          <HopCount>0</HopCount>
          <PreferredSnmpVersion>SNMP2c</PreferredSnmpVersion>
          <DisableIcmp>false</DisableIcmp>
          <AllowDuplicateNodes>false</AllowDuplicateNodes>
          <IsAutoImport>true</IsAutoImport>
          <IsHidden>$DeleteProfileAfterDiscoveryCompletes</IsHidden>
          <PluginConfigurations>
              <PluginConfiguration>
                  <PluginConfigurationItem>$($CorePluginConfiguration.InnerXml)</PluginConfigurationItem>
                  <PluginConfigurationItem>$($InterfacesPluginConfiguration.InnerXml)</PluginConfigurationItem>
              </PluginConfiguration>
          </PluginConfigurations>
      </StartDiscoveryContext>
      ").DocumentElement)

       

      #Running The Discovery ( I get the error noted at the top regardless of the line below.  To be honest, I guessed this would be at the bottom of the script.

      $DiscoveryProfileID = (Invoke-SwisVerb $swis Orion.Discovery StartDiscovery @($StartDiscoveryContext)).InnerText

        • Re: API Network Discovery
          tdanner

          Where you have this line:

           

               $InterfacesPluginConfiguration = Invoke-SwisVerb $swis Orion.NPM.Interfaces CreateInterfacesPluginConfiguration

           

          It should be this instead:

           

               $InterfacesPluginConfiguration = Invoke-SwisVerb $swis Orion.NPM.Interfaces CreateInterfacesPluginConfiguration @($InterfacesPluginConfigurationContext)

           

          Also, right before that you have this line:

           

               $CorePluginConfiguration = Invoke-SwisVerb $swis Orion.Discovery CreateCorePluginConfiguration @($CorePluginConfigurationContext

           

          That is missing the ) at the end. Copy/paste error?

          1 of 1 people found this helpful
            • Re: API Network Discovery
              nick_scott

              Wow, thanks for the quick reply.  Yes those were copy and paste errors.  Fixing both of those has led me to my next error/question.  The error below is referencing this line

               

              $CorePluginConfiguration = Invoke-SwisVerb $swis Orion.Discovery CreateCorePluginConfiguration @($CorePluginConfigurationContext)

                                          ^

               

               

               

              PS C:\Users\nsd000.QACMA> C:\Users\nsd000.QACMA\Documents\PowerShell Scripts\Do not Modify\Discovery.ps1

               

              Invoke-SwisVerb : Verb Orion.Discovery.CreateCorePluginConfiguration cannot unpackage parameter 0 of type SolarWinds.Data.Providers.Orion.Verbs.Discovery+CorePluginConfigurationContext

               

              At C:Discovery.ps1:50 char:28

               

              + $CorePluginConfiguration = Invoke-SwisVerb $swis Orion.Discovery CreateCorePlugi ...

               

              + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

               

                  + CategoryInfo          : InvalidOperation: (:) [Invoke-SwisVerb], FaultException`1

               

                  + FullyQualifiedErrorId : SwisError,SwisPowerShell.InvokeSwisVerb

               

               

                • Re: API Network Discovery
                  tdanner

                  The problem might be the empty <CredentialID></CredentialID> element in $CorePluginConfigurationContext. The contents of each <CredentialID> element must be an integer.

                  1 of 1 people found this helpful
                    • Re: API Network Discovery
                      nick_scott

                      Nice find, the credential paremeter was an issue.  That has been corrected, now the script is erroring on the last line

                       

                      $DiscoveryProfileID = (Invoke-SwisVerb $swis Orion.Discovery StartDiscovery @($StartDiscoveryContext)).InnerText

                                             ^

                      PS C:\Users\nsd000.QACMA> C:\Users\nsd000.QACMA\Documents\PowerShell Scripts\Do not Modify\Discovery.ps1


                      Invoke-SwisVerb : ProvideFault failed, check fault information.

                       

                      At C:Discovery.ps1:88 char:24

                       

                      + $DiscoveryProfileID = (Invoke-SwisVerb $swis Orion.Discovery StartDiscovery @($S ...

                       

                      +                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

                       

                          + CategoryInfo          : InvalidOperation: (:) [Invoke-SwisVerb], FaultException`1

                       

                          + FullyQualifiedErrorId : SwisError,SwisPowerShell.InvokeSwisVe

                       

                       

                                                             ^

                      • Re: API Network Discovery
                        nick_scott

                        Nevermind, I think I got it (u got it).  Thanks TDANNER!!!!!!  You are the MAN!!!!

                         

                        Regards,

                         

                        Nicholas Dentry

                          • Re: API Network Discovery
                            it.sudhanshu

                            Hi Nick,

                             

                            Great Job - I tried the same script but it executed with few errors like:

                            PS C:\Program Files (x86)\Solarwinds\Orion SDK\SWQL Studio> C:\Program Files (x86)\Solarwinds\Orion SDK\SWQL Studio\discovery_test.ps1


                            Invoke-SwisVerb : Verb Orion.NPM.Interfaces.CreateInterfacesPluginConfiguration: Not found

                             

                            At C:\Program Files (x86)\Solarwinds\Orion SDK\SWQL Studio\discovery_test.ps1:76 char:34

                             

                            + $InterfacesPluginConfiguration = Invoke-SwisVerb $swis Orion.NPM.Interfaces Crea ...

                             

                            + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

                             

                                + CategoryInfo          : InvalidOperation: (:) [Invoke-SwisVerb], FaultException`1

                             

                                + FullyQualifiedErrorId : SwisError,SwisPowerShell.InvokeSwisVerb

                             

                            Invoke-SwisVerb : ProvideFault failed, check fault information.

                             

                            At C:\Program Files (x86)\Solarwinds\Orion SDK\SWQL Studio\discovery_test.ps1:106 char:24

                             

                            + $DiscoveryProfileID = (Invoke-SwisVerb $swis Orion.Discovery StartDiscovery @($S ...

                             

                            +                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

                             

                                + CategoryInfo          : InvalidOperation: (:) [Invoke-SwisVerb], FaultException`1

                             

                                + FullyQualifiedErrorId : SwisError,SwisPowerShell.InvokeSwisVerb

                             

                             

                            Can you suggest what would be the possible issues....

                             

                              • Re: API Network Discovery
                                tdanner

                                it.sudhanshu - what products/versions do you have installed?

                                1 of 1 people found this helpful
                                  • Re: API Network Discovery
                                    it.sudhanshu

                                    Npm 10.5

                                      • Re: API Network Discovery
                                        tdanner

                                        Unfortunately, that version is too old for the discovery API.

                                        1 of 1 people found this helpful
                                          • Re: API Network Discovery
                                            it.sudhanshu

                                            yes ! but when i execute the same script on my NPM 11.5.2 then  it creates a discovery profile Under sonar discovery but ending with the error in the script ..

                                             

                                            PS C:\Users\adm2Mukherj3\Desktop> C:\Users\adm2Mukherj3\Desktop\discovery_test.ps1


                                            Invoke-SwisVerb : Verb Orion.NPM.Interfaces.CreateInterfacesPluginConfiguration: Not found

                                             

                                            At C:\Users\adm2Mukherj3\Desktop\discovery_test.ps1:76 char:34

                                             

                                            + $InterfacesPluginConfiguration = Invoke-SwisVerb $swis Orion.NPM.Interfaces Crea ...

                                             

                                            + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

                                             

                                                + CategoryInfo          : InvalidOperation: (:) [Invoke-SwisVerb], FaultException`1

                                             

                                                + FullyQualifiedErrorId : SwisError,SwisPowerShell.InvokeSwisVerb

                                             

                                            can you suggest

                                             

                                             

                                              • Re: API Network Discovery
                                                it.sudhanshu

                                                @here is the complete script that I run with the below errors :

                                                 

                                                #Add the snapin
                                                Add-PSSnapin SwisSnapin

                                                 

                                                #create a connection to solarwinds

                                                $hostname = 'localhost'
                                                $username = 'admin'
                                                $password = 'Welcome@12345'

                                                 

                                                #swis = Connect-Swis -Hostanme $hostname -Trusted
                                                $swis = Connect-Swis -Hostname $hostname -Username $username -Password $password

                                                 

                                                #Everything Above This Line is Strictly Related to SwisConnection

                                                $CorePluginConfigurationContext = ([xml]"
                                                <CorePluginConfigurationContext xmlns='http://schemas.solarwinds.com/2012/Orion/Core' xmlns:i='http://www.w3.org/2001/XMLSchema-instance'>
                                                        <IpAddressRange>
                                                            <StartAddress>10.247.6.104</StartAddress>
                                                            <EndAddress>10.247.6.105</EndAddress>
                                                        </IpAddressRange>
                                                    <Credentials>
                                                        <SharedCredentialInfo>
                                                            <CredentialID>1</CredentialID>
                                                            <CredentialID>2</CredentialID>
                                                            <CredentialID>7</CredentialID>
                                                            <CredentialID>8</CredentialID>
                                                            <CredentialID>9</CredentialID>
                                                            <CredentialID>11</CredentialID>
                                                            <CredentialID>12</CredentialID>
                                                            <CredentialID>13</CredentialID>
                                                            <CredentialID>16</CredentialID>
                                                            <CredentialID>17</CredentialID>
                                                            <CredentialID>18</CredentialID>
                                                            <CredentialID>19</CredentialID>
                                                            <CredentialID>24</CredentialID>
                                                            <CredentialID>25</CredentialID>
                                                            <CredentialID>26</CredentialID>
                                                            <CredentialID>28</CredentialID>
                                                            <Order>1</Order>
                                                        </SharedCredentialInfo>
                                                    </Credentials>
                                                    <WmiRetriesCount>1</WmiRetriesCount>
                                                    <WmiRetryIntervalMiliseconds>1000</WmiRetryIntervalMiliseconds>
                                                </CorePluginConfigurationContext>
                                                ").DocumentElement

                                                $CorePluginConfiguration = Invoke-SwisVerb $swis Orion.Discovery CreateCorePluginConfiguration @($CorePluginConfigurationContext)

                                                $InterfacesPluginConfigurationContext = ([xml]"
                                                <InterfacesDiscoveryPluginContext xmlns='http://schemas.solarwinds.com/2008/Interfaces'
                                                                                  xmlns:a='http://schemas.microsoft.com/2003/10/Serialization/Arrays'>
                                                    <AutoImportStatus>
                                                        <a:string>Up</a:string>
                                                        <a:string>Down</a:string>
                                                        <a:string>Shutdown</a:string>
                                                    </AutoImportStatus>
                                                    <AutoImportVirtualTypes>
                                                        <a:string>Virtual</a:string>
                                                        <a:string>Physical</a:string>
                                                    </AutoImportVirtualTypes>
                                                    <AutoImportVlanPortTypes>
                                                        <a:string>Trunk</a:string>
                                                        <a:string>Access</a:string>
                                                        <a:string>Unknown</a:string>
                                                    </AutoImportVlanPortTypes>
                                                    <UseDefaults>False</UseDefaults>
                                                </InterfacesDiscoveryPluginContext>
                                                ").DocumentElement

                                                $InterfacesPluginConfiguration = Invoke-SwisVerb $swis Orion.NPM.Interfaces CreateInterfacesPluginConfiguration @($InterfacesPluginConfigurationContext)

                                                $EngineID = 6
                                                $DeleteProfileAfterDiscoveryCompletes = "false"

                                                $StartDiscoveryContext = ([xml]"
                                                <StartDiscoveryContext xmlns='http://schemas.solarwinds.com/2012/Orion/Core' xmlns:i='http://www.w3.org/2001/XMLSchema-instance'>
                                                    <Name> NODEADD_Automated_Discovery_test $([DateTime]::Now)</Name>
                                                    <EngineId>6</EngineId>
                                                    <JobTimeoutSeconds>3600</JobTimeoutSeconds>
                                                    <SearchTimeoutMiliseconds>2500</SearchTimeoutMiliseconds>
                                                    <SnmpTimeoutMiliseconds>2500</SnmpTimeoutMiliseconds>
                                                    <SnmpRetries>1</SnmpRetries>
                                                    <RepeatIntervalMiliseconds>2500</RepeatIntervalMiliseconds>
                                                    <SnmpPort>161</SnmpPort>
                                                    <HopCount>0</HopCount>
                                                    <PreferredSnmpVersion>SNMP2c</PreferredSnmpVersion>
                                                    <DisableIcmp>false</DisableIcmp>
                                                    <AllowDuplicateNodes>false</AllowDuplicateNodes>
                                                    <IsAutoImport>TRUE</IsAutoImport>
                                                    <IsHidden>false</IsHidden>
                                                    <PluginConfigurations>
                                                        <PluginConfiguration>
                                                            <PluginConfigurationItem>$($CorePluginConfiguration.InnerXml)</PluginConfigurationItem>
                                                            <PluginConfigurationItem>$($InterfacesPluginConfiguration.InnerXml)</PluginConfigurationItem>
                                                        </PluginConfiguration>
                                                    </PluginConfigurations>
                                                </StartDiscoveryContext>
                                                ").DocumentElement

                                                $DiscoveryProfileID = (Invoke-SwisVerb $swis Orion.Discovery StartDiscovery @($StartDiscoveryContext)).InnerText

                                                 

                                                 

                                                 

                                                 

                                                 

                                                 

                                                 

                                                Errors::

                                                ------------------------------------------------------------------------------------------------------------------------------------------------

                                                PS C:\Users\adm2Mukherj3\Desktop> C:\Users\adm2Mukherj3\Desktop\discovery_test.ps1


                                                Invoke-SwisVerb : Verb Orion.NPM.Interfaces.CreateInterfacesPluginConfiguration: Not found

                                                 

                                                At C:\Users\adm2Mukherj3\Desktop\discovery_test.ps1:62 char:34

                                                 

                                                + $InterfacesPluginConfiguration = Invoke-SwisVerb $swis Orion.NPM.Interfaces Crea ...

                                                 

                                                + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

                                                 

                                                    + CategoryInfo          : InvalidOperation: (:) [Invoke-SwisVerb], FaultException`1

                                                 

                                                    + FullyQualifiedErrorId : SwisError,SwisPowerShell.InvokeSwisVerb

                                                 

                                                Invoke-SwisVerb : Verb Orion.Discovery.StartDiscovery cannot unpackage parameter 0

                                                 

                                                At C:\Users\adm2Mukherj3\Desktop\discovery_test.ps1:92 char:24

                                                 

                                                + $DiscoveryProfileID = (Invoke-SwisVerb $swis Orion.Discovery StartDiscovery @($S ...

                                                 

                                                +                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

                                                 

                                                    + CategoryInfo          : InvalidOperation: (:) [Invoke-SwisVerb], FaultException`1

                                                 

                                                    + FullyQualifiedErrorId : SwisError,SwisPowerShell.InvokeSwisVerb

                                              • Re: API Network Discovery
                                                it.sudhanshu

                                                2 more questions  -

                                                 

                                                Question1 : Can i pass the Ip range from a text file <notepad1.txt> and execute the script .

                                                 

                                                Question 2 : how to tweak the scripts when i have to use the SNMPv3  polling.

                                                  • Re: API Network Discovery
                                                    tdanner

                                                    1. You can't pass a text file for the IP range, but you can read the text file in PowerShell and use the values in it to build the discovery objects.

                                                    2. There's nothing special to change in this script for SNMPv3 polling. Just make sure you are providing the appropriate CredentialIDs for your saved SNMPv3 credential sets.

                                            • Re: API Network Discovery
                                              nick_scott

                                              Did you modify these two lines ?

                                               

                                                          <StartAddress>x.x.168.1</StartAddress>

                                                          <EndAddress>X.x.168.250</EndAddress>

                                               

                                              I mentioned in the last post these would need modification.  Off to lunch GL my friend

                                          • Re: API Network Discovery
                                            nick_scott

                                            The script runs as expected, what I cant figure out is why nothing is being returned.  I see the job "Run" and "Finish" in the UI.  When looking at the Discovery table, I see the various jobs kickoff and "Finish".  I made sure I only scanned networks where devices were located, specifically devices already in this instance of SolarWinds.   Another strange issue is that when set AutoImport to true it says if found two devices.  When attempting to see what those are nothing is returned.  In the snippet below you will see AutoImport and a result of 2.  In this particular SolarWinds instance there are two different polling engines, both have been used in the script.

                                             

                                             

                                            Complete Script below

                                             

                                            $ErrorActionPreference = 'Stop'

                                             

                                            #Add the snapin
                                            Add-PSSnapin SwisSnapin

                                             

                                            #create a connection to solarwinds

                                            $hostname = 'X'
                                            $username = 'X'
                                            $password = 'X'

                                             

                                            #swis = Connect-Swis -Hostanme $hostname -Trusted
                                            $swis = Connect-Swis -Hostname $hostname -Username $username -Password $password

                                             

                                            #Everything Above This Line is Strictly Related to SwisConnection

                                            $CorePluginConfigurationContext = ([xml]"
                                            <CorePluginConfigurationContext xmlns='http://schemas.solarwinds.com/2012/Orion/Core' xmlns:i='http://www.w3.org/2001/XMLSchema-instance'>
                                                    <IpAddressRange>
                                                        <StartAddress>10.X.139.1</StartAddress>
                                                        <EndAddress>10.X.169.254</EndAddress>
                                                    </IpAddressRange>
                                                <Credentials>
                                                    <SharedCredentialInfo>
                                                        <CredentialID>1</CredentialID>
                                                        <CredentialID>2</CredentialID>
                                                        <CredentialID>7</CredentialID>
                                                        <CredentialID>8</CredentialID>
                                                        <CredentialID>9</CredentialID>
                                                        <CredentialID>11</CredentialID>
                                                        <CredentialID>12</CredentialID>
                                                        <CredentialID>13</CredentialID>
                                                        <CredentialID>16</CredentialID>
                                                        <CredentialID>17</CredentialID>
                                                        <CredentialID>18</CredentialID>
                                                        <CredentialID>19</CredentialID>
                                                        <CredentialID>24</CredentialID>
                                                        <CredentialID>25</CredentialID>
                                                        <CredentialID>26</CredentialID>
                                                        <CredentialID>28</CredentialID>
                                                        <Order>1</Order>
                                                    </SharedCredentialInfo>
                                                </Credentials>
                                                <WmiRetriesCount>1</WmiRetriesCount>
                                                <WmiRetryIntervalMiliseconds>1000</WmiRetryIntervalMiliseconds>
                                            </CorePluginConfigurationContext>
                                            ").DocumentElement

                                            $CorePluginConfiguration = Invoke-SwisVerb $swis Orion.Discovery CreateCorePluginConfiguration @($CorePluginConfigurationContext)

                                            $InterfacesPluginConfigurationContext = ([xml]"
                                            <InterfacesDiscoveryPluginContext xmlns='http://schemas.solarwinds.com/2008/Interfaces'
                                                                              xmlns:a='http://schemas.microsoft.com/2003/10/Serialization/Arrays'>
                                                <AutoImportStatus>
                                                    <a:string>Up</a:string>
                                                    <a:string>Down</a:string>
                                                    <a:string>Shutdown</a:string>
                                                </AutoImportStatus>
                                                <AutoImportVirtualTypes>
                                                    <a:string>Virtual</a:string>
                                                    <a:string>Physical</a:string>
                                                </AutoImportVirtualTypes>
                                                <AutoImportVlanPortTypes>
                                                    <a:string>Trunk</a:string>
                                                    <a:string>Access</a:string>
                                                    <a:string>Unknown</a:string>
                                                </AutoImportVlanPortTypes>
                                                <UseDefaults>false</UseDefaults>
                                            </InterfacesDiscoveryPluginContext>
                                            ").DocumentElement

                                            $InterfacesPluginConfiguration = Invoke-SwisVerb $swis Orion.NPM.Interfaces CreateInterfacesPluginConfiguration @($InterfacesPluginConfigurationContext)

                                            $EngineID = 2
                                            $DeleteProfileAfterDiscoveryCompletes = "false"

                                            $StartDiscoveryContext = ([xml]"
                                            <StartDiscoveryContext xmlns='http://schemas.solarwinds.com/2012/Orion/Core' xmlns:i='http://www.w3.org/2001/XMLSchema-instance'>
                                                <Name> Test $([DateTime]::Now)</Name>
                                                <EngineId>$EngineID</EngineId>
                                                <JobTimeoutSeconds>3600</JobTimeoutSeconds>
                                                <SearchTimeoutMiliseconds>2500</SearchTimeoutMiliseconds>
                                                <SnmpTimeoutMiliseconds>2500</SnmpTimeoutMiliseconds>
                                                <SnmpRetries>1</SnmpRetries>
                                                <RepeatIntervalMiliseconds>2500</RepeatIntervalMiliseconds>
                                                <SnmpPort>161</SnmpPort>
                                                <HopCount>0</HopCount>
                                                <PreferredSnmpVersion>SNMP2c</PreferredSnmpVersion>
                                                <DisableIcmp>false</DisableIcmp>
                                                <AllowDuplicateNodes>false</AllowDuplicateNodes>
                                                <IsAutoImport>true</IsAutoImport>
                                                <IsHidden>false</IsHidden>
                                                <PluginConfigurations>
                                                    <PluginConfiguration>
                                                        <PluginConfigurationItem>$($CorePluginConfiguration.InnerXml)</PluginConfigurationItem>
                                                        <PluginConfigurationItem>$($InterfacesPluginConfiguration.InnerXml)</PluginConfigurationItem>
                                                    </PluginConfiguration>
                                                </PluginConfigurations>
                                            </StartDiscoveryContext>
                                            ").DocumentElement

                                            $DiscoveryProfileID = (Invoke-SwisVerb $swis Orion.Discovery StartDiscovery @($StartDiscoveryContext)).InnerText

                                      • Re: API Network Discovery
                                        nick_scott

                                        Got the scans working.  Below is my entire working script.  Now, I need to figure out how to schedule them (in script below, you will have to define start, and end address)  Thanks again TDANNER!

                                         

                                        $ErrorActionPreference = 'Stop'

                                        #Add the snapin
                                        Add-PSSnapin SwisSnapin

                                        #create a connection to solarwinds

                                        $hostname = 'X'
                                        $username = 'X'
                                        $password = 'X'

                                        #swis = Connect-Swis -Hostanme $hostname -Trusted
                                        $swis = Connect-Swis -Hostname $hostname -Username $username -Password $password

                                        #Everything Above This Line is Strictly Related to SwisConnection

                                         

                                        $CorePluginConfigurationContext = ([xml]"
                                        <CorePluginConfigurationContext xmlns='http://schemas.solarwinds.com/2012/Orion/Core' xmlns:i='http://www.w3.org/2001/XMLSchema-instance'>
                                            <IpRanges>
                                                <IpAddressRange>
                                                    <StartAddress>x.x.168.1</StartAddress>
                                                    <EndAddress>X.x.168.250</EndAddress>
                                                </IpAddressRange>
                                            </IpRanges>
                                            <Credentials>
                                                <SharedCredentialInfo>
                                                    <CredentialID>1</CredentialID>
                                                    <CredentialID>2</CredentialID>
                                                    <CredentialID>7</CredentialID>
                                                    <CredentialID>8</CredentialID>
                                                    <CredentialID>9</CredentialID>
                                                    <CredentialID>11</CredentialID>
                                                    <Order>1</Order>
                                                </SharedCredentialInfo>
                                            </Credentials>
                                            <WmiRetriesCount>1</WmiRetriesCount>
                                            <WmiRetryIntervalMiliseconds>1000</WmiRetryIntervalMiliseconds>
                                        </CorePluginConfigurationContext>
                                        ").DocumentElement

                                        $CorePluginConfiguration = Invoke-SwisVerb $swis Orion.Discovery CreateCorePluginConfiguration @($CorePluginConfigurationContext)

                                        $InterfacesPluginConfigurationContext = ([xml]"
                                        <InterfacesDiscoveryPluginContext xmlns='http://schemas.solarwinds.com/2008/Interfaces'
                                                                          xmlns:a='http://schemas.microsoft.com/2003/10/Serialization/Arrays'>
                                            <AutoImportStatus>
                                                <a:string>Up</a:string>
                                                <a:string>Down</a:string>
                                                <a:string>Shutdown</a:string>
                                            </AutoImportStatus>
                                            <AutoImportVirtualTypes>
                                                <a:string>Virtual</a:string>
                                                <a:string>Physical</a:string>
                                            </AutoImportVirtualTypes>
                                            <AutoImportVlanPortTypes>
                                                <a:string>Trunk</a:string>
                                                <a:string>Access</a:string>
                                                <a:string>Unknown</a:string>
                                            </AutoImportVlanPortTypes>
                                            <UseDefaults>false</UseDefaults>
                                        </InterfacesDiscoveryPluginContext>
                                        ").DocumentElement

                                        $InterfacesPluginConfiguration = Invoke-SwisVerb $swis Orion.NPM.Interfaces CreateInterfacesPluginConfiguration @($InterfacesPluginConfigurationContext)

                                        $EngineID = 2
                                        $DeleteProfileAfterDiscoveryCompletes = "false"

                                        $StartDiscoveryContext = ([xml]"
                                        <StartDiscoveryContext xmlns='http://schemas.solarwinds.com/2012/Orion/Core' xmlns:i='http://www.w3.org/2001/XMLSchema-instance'>
                                            <Name> Test $([DateTime]::Now)</Name>
                                            <EngineId>$EngineID</EngineId>
                                            <JobTimeoutSeconds>3600</JobTimeoutSeconds>
                                            <SearchTimeoutMiliseconds>2500</SearchTimeoutMiliseconds>
                                            <SnmpTimeoutMiliseconds>2500</SnmpTimeoutMiliseconds>
                                            <SnmpRetries>1</SnmpRetries>
                                            <RepeatIntervalMiliseconds>2500</RepeatIntervalMiliseconds>
                                            <SnmpPort>161</SnmpPort>
                                            <HopCount>0</HopCount>
                                            <PreferredSnmpVersion>SNMP2c</PreferredSnmpVersion>
                                            <DisableIcmp>false</DisableIcmp>
                                            <AllowDuplicateNodes>false</AllowDuplicateNodes>
                                            <IsAutoImport>false</IsAutoImport>
                                            <IsHidden>false</IsHidden>
                                            <PluginConfigurations>
                                                <PluginConfiguration>
                                                    <PluginConfigurationItem>$($CorePluginConfiguration.InnerXml)</PluginConfigurationItem>
                                                    <PluginConfigurationItem>$($InterfacesPluginConfiguration.InnerXml)</PluginConfigurationItem>
                                                </PluginConfiguration>
                                            </PluginConfigurations>
                                        </StartDiscoveryContext>
                                        ").DocumentElement

                                        $DiscoveryProfileID = (Invoke-SwisVerb $swis Orion.Discovery StartDiscovery @($StartDiscoveryContext)).InnerText