This discussion has been locked. The information referenced herein may be inaccurate due to age, software updates, or external references.
You can no longer post new replies to this discussion. If you have a similar question you can start a new discussion in this forum.

Error running a Node query from PowerShell after SDK install

I successfully installed the PowerShell .dll file for both 32-bit and 64-bit shells, and loaded SwisSnapin in my PS runspace using this command;

Add-PSSnapin SwisSnapin

Then ran $swis = Connect-Swis and provided my credentials when prompted

Then I do this query;

Get-SwisData $swis 'SELECT NodeID, Caption FROM Orion.Nodes'

but I get this message;

Get-SwisData : The communication object, System.ServiceModel.Security.SecuritySessionClientSettings`1+ClientSecurityDup
lexSessionChannel[System.ServiceModel.Channels.IDuplexSessionChannel], cannot be used for communication because it is i
n the Faulted state.
At line:1 char:13
+ Get-SwisData <<<<  $swis 'SELECT NodeID, Caption FROM Orion.Nodes'
    + CategoryInfo          : NotSpecified: (:) [Get-SwisData], CommunicationObjectFaultedException
    + FullyQualifiedErrorId : System.ServiceModel.CommunicationObjectFaultedException,SwisPowerShell.GetSwisData

I'm using the Orion NPM administrator credentials.  What am I missing?

  • I would look at C:\ProgramData\SolarWinds\InformationService\v2.0\Orion.InformationService.log to see if there are any errors.

    Usually when there's a problem processing a query the error is propagated back to powershell so you can see what went wrong, but some issues that occur very early or very late in the request lifecycle lead to this unhelpful "CommunicationObjectFaultedException" thing instead.

  • 2012-01-18 08:04:44,278 [5] ERROR SolarWinds.InformationService.Serialization.XmlSerializer - Error serializing query results
    System.Data.SqlClient.SqlException: Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.
       at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
       at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
       at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
       at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
       at System.Data.SqlClient.SqlDataReader.ConsumeMetaData()
       at System.Data.SqlClient.SqlDataReader.get_MetaData()
       at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
       at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
       at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
       at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
       at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
       at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior)
       at SolarWinds.InformationService.DataProviders.SqlQueryRelation.<GetEnumerator>d__0.MoveNext()
       at SolarWinds.Data.Query.PhysicalQueryPlan.ProjectOp.<GetEnumerator>d__0.MoveNext()
       at SolarWinds.Data.Query.Processor.TupleResultReader.MoveNext()
       at SolarWinds.InformationService.Serialization.XmlResponseSerializer..ctor(IQueryResultReader reader, Boolean includeQueryPlan)
       at SolarWinds.InformationService.Serialization.XmlSerializer.GetSerializer()
       at SolarWinds.InformationService.Serialization.XmlSerializer.OnSerialize(XmlWriter writer)

    Seeing this makes me think the query is too wide in scope, so I pared it down with a WHERE and it works fine!  The new query;

    Get-SwisData $swis 'SELECT NodeID, Caption FROM Orion.Nodes WHERE NodeID=18'

    Now I'm ready to go!  Thanks.