4 Replies Latest reply on Aug 21, 2019 9:55 AM by Anthony Ussery

    Create Container with Parent in Powershell

    Anthony Ussery

      I can't seem to get a script of mine working, can someone help me figure this out?  I'm still pretty new to using the API and I maybe touch PowerShell twice a year, so this is kinda new territory for me.  Whenever I try to run it, it asks me for the EntityName, so I already know it doesn't work like it does in my head.

       

      Here's the script:

       

       

      param(

      [string]$parentID,

      [string]$name,

      [int]$statCalc)

       

      #Credentials should be passed from outside in a variable called $cred.

       

      # Connect to SWIS

      $hostname = "localhost"

      $swis = Connect-Swis -Credential $cred -host $hostname

       

      # Define Properties

      $newContainerProps = @{

          parentID = $parentID;

          Name = $name;

      statusCalculator = $statCalc;

       

          # === default values ===

       

          frequency = 60;

          owner = 'CORE'

          Description = 'Active-Passive Pair of Service Monitors'

          pollingEnabled = 'TRUE'

      }

       

      #Create the Container

      Invoke-SwisVerb $swis -Verb createContainerWithParent -Arguments $newContainerProps