4 Replies Latest reply on Jun 10, 2018 1:20 PM by niksheridan

    NSX Power Shell Script - Security Group

    rajeevsrikant Expert
    vExpertCommunity Warriors

      I am trying to extract the IP addresses from a particular security group using Power Shell API

      Below is the power shell script I am using. Its not working

      Any inputs what i need to change in the script to make it work.

       

       

      $NSXUsername = "admin"

      $NSXPassword = "VMware1!"

      $auth =  [System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes($NSXUsername+":"+$NSXPassword))

      $head = @{"Authorization"="Basic $auth"}

      $uri = "https://192.168.110.15"

       

      [System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true}

      Invoke-RestMethod -uri "$uri/api/2.0/services/securitygroup/securitygroup-16/translation/ipaddresses" -Body $body -Method:Get  $head