4 Replies Latest reply on Feb 22, 2016 3:28 PM by datwiddler

    powershell get-swisdata multiple parameters

    datwiddler

      Running SDK 2.0 and working in powershell.

       

      Trying to running a query with multiple parameters and I'm running into errors. Tried looking for documentation but not finding anything even in the examples

       

      this is my query:

       

      $checkmembership = Get-SwisData $swis "select ContainerID,MemberPrimaryId,MemberURI from orion.containermembers where memberuri=@a AND ContainerID=@b" @{a=$getnodeuri; b=$getcontainerid;}

       

      and this is what I get:

       

      Get-SwisData : Must declare the scalar variable "@b".

      At line:1 char:20

      + $checkmembership = Get-SwisData $swis "select ContainerID,MemberPrimaryId,Member ...

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

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

          + FullyQualifiedErrorId : SwisError,SwisPowerShell.GetSwisData

       

      Am I missing something?

        • Re: powershell get-swisdata multiple parameters
          Jan Pelousek

          Which Orion platform do you use? Which Powershell version? Assuming the variables($getnodeuri, $getContainerid) are properly filled in, the same construction works perfectly for me.

            • Re: powershell get-swisdata multiple parameters
              datwiddler

              Jan Pelousek wrote:

               

              Which Orion platform do you use? Which Powershell version? Assuming the variables($getnodeuri, $getContainerid) are properly filled in, the same construction works perfectly for me.

              This is on NPM version 11.5.2

               

              PowerShell V4 running on Windows Sever 2012r2

               

              >$PSVersionTable.PSVersion

               

              Major  Minor  Build  Revision

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

              4      0      -1    -1  

               

              I ran the same query in SWSQL and it works.

               

               

              I took the results, hard coded the variables and tried to run it again

               

              $getnodeuri = 'swis://NMS02-SRV./Orion/Orion.Nodes/NodeID=29204'

              $getcontainerid = '19059'

              $checkmembership = Get-SwisData $swis "select containerid,memberprimaryid,memberuri from orion.containermembers where memberuri=@a and containerid=@b" @{a=$getnodeuri; b=$getcontainerid}

               

              I still get the same error. I even closed my editor, and signed out and back in again.

               

              Get-SwisData : Must declare the scalar variable "@b".

              At line:1 char:20

              + $checkmembership = Get-SwisData $swis "select containerid,memberprimaryid,member ...

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

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

                  + FullyQualifiedErrorId : SwisError,SwisPowerShell.GetSwisData