3 Replies Latest reply on Aug 20, 2013 2:23 AM by Jan Pelousek

    Get error when run get-swisdata $Swis

    networkingkool

      I got this error when run get-swisdata $Swis "select Solarwind_Modules.dbo.Modules.Name from Solarwind_Modules.dbo.Modules"

       

      Get-SwisData : Source entity [Solarwind_Modules.dbo.Modules] not found in catalog

      At line:1 char:13

      + get-swisdata <<<<  $Swis

          + CategoryInfo          : InvalidOperation: (:) [Get-SwisData], FaultException`1

          + FullyQualifiedErrorId : SwisError,SwisPowerShell.GetSwisData

       

       

      I query this line "select Solarwind_Modules.dbo.Modules.Name from Solarwind_Modules.dbo.Modules" in SQL Server Management Studio, it works, but whole command in PowerShell, it doesn't

        • Re: Get error when run get-swisdata $Swis
          Jan Pelousek

          Hi networkingkool,

           

          Firstly - please don't mix SQL and SWQL. Get-swisdata cmdlet is designed for querying against SWIS, not SQL.

          Secondly - If you need info about modules, please use query : SELECT Name, Version FROM Orion.Module

           

          I hope it helped.

           

          Tip: For queries testing before putting it into the script, you can use SWQL studio, which is a part of Orion SDK too.

          1 of 1 people found this helpful
            • Re: Get error when run get-swisdata $Swis
              networkingkool

              Thanks, I 'm very new to SWIS...

               

              After upgrade to SDK 1.7 I ran successfully Script "IPAM_UDT.ps1," the script to pull data from installed modules and aggregates the data in the IPAM view via custom properties.

              But I get these outputs like this one:

              UDTIP = 192.168.250.15

              ConnectionType = Indirect

              No record exists for IP Address properties 192.168.250.15

              Inserting Null Row with IP Node ID = 4880

              Exception calling "ExecuteNonQuery" with "0" argument(s): "ExecuteNonQuery requires an open and available Connection. The connection's current state is closed."

              At D:\Solarwinds Softs\Orion IPAM Integrations\IPAM_UDT.ps1:46 char:26

              +     $Command.ExecuteNonQuery <<<< ()

                  + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException

                  + FullyQualifiedErrorId : DotNetMethodException

               

               

              Exception calling "ExecuteNonQuery" with "0" argument(s): "ExecuteNonQuery requires an open and available Connection. The connection's current state is closed."

              At D:\Solarwinds Softs\Orion IPAM Integrations\IPAM_UDT.ps1:198 char:29

              +              $Command.ExecuteNonQuery <<<< ()

               

                  + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException

                  + FullyQualifiedErrorId : DotNetMethodException

               

              Is this an error? Please help me in this case, I need this script very much

               

              Thanks,

                • Re: Get error when run get-swisdata $Swis
                  Jan Pelousek

                  Hello, according to your console output I assume you are using SQL management libraries (not functionality of SDK), but in case of SQL commands you need to create new object for SQL Command, which will contain also Connection information and also open the connection and close after you finish. The syntax will be like:

                   

                  $ConnectionString = ("Server=" + $Server + "; Database='" + $Database + "'; User Id='" + $SQL_Login + "'; Password='" + $SQL_Password + "'; Trusted_Connection=False;")

                  $SQLConnection = New-Object system.Data.SqlClient.SqlConnection($ConnectionString)

                  $SQLConnection.Open()

                  $SQLCommand = New-Object system.Data.SqlClient.SqlCommand

                  $SQLCommand.Connection = $SQLConnection

                  $SQLCommand.CommandText = "  INSERT INTO ............" #Example. Insert your non-query command

                  $SQLCommand.ExecuteNonQuery() | Out-Null

                  $SQLConnection.Close()