Skip to content

Latest commit

 

History

History
 
 

readme.rst

Nutanix Developer Portal Code Samples - PowerShell

To use the PowerShell code samples, the following environment is recommended.

  • Windows PowerShell 5.1 or later
  • A suitable PowerShell editor, e.g. Microsoft Visual Studio Code or Microsoft Visual Studio Community. Instructions for extending Visual Studio Code with PowerShell support are provided below.
  • An alternative editor, built into some versions of Windows, is PowerShell ISE
  • Access to a Nutanix Cluster for API testing purposes.
  • Nutanix Community Edition is supported but may not always provide the exact same APIs as a "full" Nutanix cluster.

Note

Please note that instructions provided in this repository will assume the use of Visual Studio Code software.

PowerShell Script Usage

The provided PowerShell scripts are designed to be standalone and can be run without additional dependencies.

The examples and screenshots below are from the create_vm_v3_basic.ps1 sample.

  1. Open Windows PowerShell (administrative permissions are not required).

  2. Verify your PowerShell version by entering $psversiontable or $PSVersionTable (the variable is not case-sensitive)

    check_ps_version.png
  3. Select View > Extensions.

  4. In the search field, enter PowerShell.

  5. Install the PowerShell extension created by Microsoft.

  6. Using the selected code sample, create a new PowerShell file (extension .ps1, by default).

  7. Select the $parameters.cluster_ip variable with the correct IP address/FQDN of your cluster (the scripts will prompt for credentials).

  8. Click Debug > Start Debugging.

  9. The script will run and prompt for a username and password in the Terminal window.

  10. After entering credentials, and if the request was successful, the JSON response will show a status as shown below.

    script_output.png