WilliamLam.com

  • About
    • About
    • Privacy
  • VMware Cloud Foundation
  • VKS
  • Homelab
    • Resources
    • Nested Virtualization
  • VMware Nostalgia
  • Apple
You are here: Home / Automation / Exploring new VCSA VAMI API w/PowerCLI: Part 5

Exploring new VCSA VAMI API w/PowerCLI: Part 5

02.01.2017 by William Lam // 9 Comments

In Part 5, we are now going to have a look at networking section of the VAMI UI.

VAMI UI Area of Focus

In the Networking tab, under the "Manage" sub-tab, you can find details about the system Hostname (PNID), DNS servers as well as the configurations for each network interface (in the case of a VCHA deployment, you would have more than one network interface configured).

VAMI APIs Used

  • GET /appliance/networking/dns/hostname
  • GET /appliance/networking/dns/servers
  • GET /appliance/networking/interfaces
  • GET /appliance/techpreview/networking/ipv4

PowerCLI Function

  • Get-VAMINetwork

Sample Output


This sample script only retrieves IPv4 networking information, but you can easily retrieve IPv6 information by calling into the IPv6 VAMI API endpoints which you can refer to the documentation or the API Explorer for more details.

  • Exploring new VCSA VAMI API w/PowerCLI: Part 1
  • Exploring new VCSA VAMI API w/PowerCLI: Part 2
  • Exploring new VCSA VAMI API w/PowerCLI: Part 3
  • Exploring new VCSA VAMI API w/PowerCLI: Part 4
  • Exploring new VCSA VAMI API w/PowerCLI: Part 5
  • Exploring new VCSA VAMI API w/PowerCLI: Part 6
  • Exploring new VCSA VAMI API w/PowerCLI: Part 7
  • Exploring new VCSA VAMI API w/PowerCLI: Part 8
  • Exploring new VCSA VAMI API w/PowerCLI: Part 9
  • Exploring new VCSA VAMI API w/PowerCLI: Part 10

More from my site

  • Exploring new VCSA VAMI API w/PowerCLI: Part 10
  • Exploring new VCSA VAMI API w/PowerCLI: Part 9
  • Exploring new VCSA VAMI API w/PowerCLI: Part 8
  • Exploring new VCSA VAMI API w/PowerCLI: Part 7
  • Exploring new VCSA VAMI API w/PowerCLI: Part 6

Categories // Automation, PowerCLI, vSphere 6.5 Tags // PowerCLI, vami, vcenter server appliance, vSphere 6.5

Comments

  1. *protectedvlx says

    08/09/2018 at 1:52 am

    Link is wrong, it should be: https://github.com/lamw/PowerCLI-Example-Scripts/blob/master/Modules/VAMI/VAMI.psm1

    Reply
  2. *protectedAntoine says

    03/15/2024 at 3:59 am

    Hi William.
    Is there way to change IP Address and default gateway for VAMI using powercli ? Thx

    Reply
    • William Lam says

      03/15/2024 at 1:10 pm

      Yes. All VAMI/Appliance Management functionality is exposed via VAMI API https://developer.vmware.com/apis/vsphere-automation/latest/appliance/ which can be consumed via PowerCLI

      Reply
      • *protectedAntoine says

        03/19/2024 at 6:39 am

        Hi William. Thx for your reply. Is it possible to giveme an exemple ? my powershell knowledge isn't as goog as yours. Thx

        Reply
        • William Lam says

          03/19/2024 at 7:44 am

          Did you click through the different operations ... the page provides PowerCLI examples using some of the auto-generated cmdlets. I recommend you write down the things you'd like to automate then spend some time going through the documentation

          Reply
          • *protectedAntoine says

            03/19/2024 at 8:37 am

            Hi. Yes i did click but i didnt understand anything. i'll try to learn more about this. Thx for the link btw 🙂

          • *protectedAntoine says

            03/20/2024 at 6:55 am

            Hi WIllian. I'm sorry to come back to you again, i Tried this :

            Connect-CisServer -server "xxx.xxx.xx" -user "*protected email*" -password "xxxxxxx" | Out-Null
            $interfaces = (Get-VAMIServiceAPI -NameFilter "interfaces").list()
            $NetworkingService = Get-CisService -Name "com.vmware.appliance.networking.interfaces.ipv4"
            $Networkingconfig = $NetworkingService.Help.set.config.Create()
            #$Networkingconfig.mode = 'static'
            $Networkingconfig.mode = 'is_static'
            $Networkingconfig.address = "192.168.8.2"
            $Networkingconfig.prefix = "24"
            $Networkingconfig.default_gateway = "192.168.8.254"
            $NetworkingService.set($interfaces.name,$Networkingconfig)

            but i have this error :

            A server error occurred: 'com.vmware.vapi.std.errors.invalid_argument': Structure com.vmware.appliance.networking.interfaces.ipv4.config has a union with a field not required for this case = prefix (Server error id: 'vapi.data.structure.union.extra'). Check $Error[0].Exception.ServerError for more details.
            Au caractère Ligne:19 : 1
            + $NetworkingService.set($interfaces.name,$Networkingconfig)
            + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            + CategoryInfo : OperationStopped: (:) [], CisServerException
            + FullyQualifiedErrorId : VMware.VimAutomation.Cis.Core.Types.V1.CisServerException

            i cannot find how to set the configuration into vCenter appliance.

          • William Lam says

            03/22/2024 at 1:04 pm

            Just looking at your code, I can see several issues including what looks to be confusion between the DNS and Interface configurations ...

            Hint: Remember, the API documentation is what tells you HOW and WHAT values to use. I'm not sure why you're using "is_static" as thats only applicable for DNS https://developer.vmware.com/apis/vsphere-automation/latest/appliance/data-structures/Networking/Dns/Servers/DNSServerConfig/ and for interface "static" is NOT a valid value for mode https://developer.vmware.com/apis/vsphere-automation/latest/appliance/data-structures/Networking/Interfaces/Ipv4/Config/

            Here is a working example and again, this is all laid out in the documentation 🙂

            $NetworkingService = Get-CisService -Name "com.vmware.appliance.networking.interfaces.ipv4"
            $Networkingconfig = $NetworkingService.Help.set.config.Create()
            $Networkingconfig.mode = "STATIC"
            $Networkingconfig.address = "192.168.30.244"
            $Networkingconfig.default_gateway = "192.168.30.1"
            $Networkingconfig.prefix = "24"
            $NetworkingService.set("nic0",$Networkingconfig)

          • *protectedAntoine says

            03/30/2024 at 12:38 pm

            Hi William
            Thx for your reply and for your help. i'm sorry i didnt understand the documentation and i lack of knowladge but i'm leaning every day. i succeded to change the address Ip.
            Thx again 🙂

Thanks for the comment!Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Search

Thank Author

Author

William is Distinguished Platform Engineering Architect in the VMware Cloud Foundation (VCF) Division at Broadcom. His primary focus is helping customers and partners build, run and operate a modern Private Cloud using the VMware Cloud Foundation (VCF) platform.

Connect

  • Bluesky
  • Email
  • GitHub
  • LinkedIn
  • Mastodon
  • Reddit
  • RSS
  • Twitter
  • Vimeo

Recent

  • VMUG Connect 2025 - Minimal VMware Cloud Foundation (VCF) 5.x in a Box  05/15/2025
  • Programmatically accessing the Broadcom Compatibility Guide (BCG) 05/06/2025
  • Quick Tip - Validating Broadcom Download Token  05/01/2025
  • Supported chipsets for the USB Network Native Driver for ESXi Fling 04/23/2025
  • vCenter Identity Federation with Authelia 04/16/2025

Advertisment

Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Cookie Policy

Copyright WilliamLam.com © 2025

 

Loading Comments...