My Nutanix PowerShell scripts, rewritten for the Prism Central v4 API
Between 2016 and 2019, I wrote a series of PowerShell scripts for Nutanix AHV: creating a VM (with and without a vGPU), adding a NIC, reporting on VMs and GPUs, and checking the power settings that Citrix power actions depend on. They all use the Nutanix cmdlets snap-in, and several of them also call the v3 REST API. In October and November 2026, I added archive notices to those posts, because Nutanix is ending support for the legacy APIs, and custom snap-ins don’t load in PowerShell 7. The same went for my 2017 script that warns users about Citrix desktops they don’t use anymore, which mailed through Office 365 with Send-MailMessage and Basic auth.
A notice tells you not to use something, but it doesn’t give you anything to use instead, so I rewrote the scripts for the Prism Central v4 API, and my documentation script from May 2026 along with them. The new versions are now in the original posts, next to the old ones. If the immediate thought is TL;DR, here is the short version first.
Full disclosure: I work for Nutanix. These are my own scripts from this blog, not a Nutanix product, so test them in your own environment before you rely on them.
On this page
The short version
Eight scripts are rewritten, and the thirteen posts that carry them have the new code:
- Eight scripts, thirteen posts. Each post now has a code block with two tabs: the new version opens first, and the original is still there under its own tab.
- Prism Central v4. No Nutanix snap-in, and each script checks which v4 version (v4.0 to v4.3) your Prism Central serves. The one v3 call left is in the documentation script, which reads recovery plans from the legacy list only when the v4 list comes back empty. The Citrix part of the desktop script still needs the Citrix snap-in, so that part only runs in Windows PowerShell 5.1.
- One file per script. Nothing to dot-source and no Nutanix module to install; PSWriteHTML is optional for the inventory, and the desktop script’s mail uses the Microsoft Graph module.
- Run on 2 and 3 December 2026 against my lab Prism Central with three clusters, 108 VMs in the inventory and 444 GPU profiles.
- The deadline is Nutanix’s. The AOS and Prism Central releases targeted for Q2 CY2027 are the last to support the legacy APIs; removal starts in phases with the Q4 CY2027 release.
- The documentation script is the eighth. Its December 2026 version now collects through v4 (recovery plans fall back to the legacy list when the v4 list is empty), and it wrote all 18 chapters in my lab run on 3 December.
Get new posts by email
One email when a new post goes up. Nothing else.
I only use your address to send new posts, and every email has an unsubscribe link. See the privacy policy.
Why I rewrote them instead of only adding a notice
When I went through the old posts in October, I found that every one of the Nutanix scripts depends on two things with an end date. The first is the NutanixCmdletsPSSnapin: Microsoft no longer supports custom snap-ins in PowerShell 7, so the scripts only run in Windows PowerShell. The second is the legacy API set (v0.8, v1, v2 and v3), which several of the scripts call directly through the v3 REST API. Nutanix’s end-of-life bulletin (revised June 2026) says the AOS and Prism Central releases targeted for Q2 CY2027 are the last to support those APIs, and that they’ll be removed in phases starting with the Q4 CY2027 release.
So the archive notices were right, but these posts are still out there for anyone looking for a way to create a VM or report on vGPUs with PowerShell, and a warning on its own leaves them with nothing to run. I’d rather they find a script that works against a current Prism Central.
What the v4 versions have in common
I wanted every script to be one file that you can copy from the post and run, so there’s no Nutanix module to install and no shared script to dot-source. That means each script carries its own small Prism Central client near the top of the file. This is how you’d run the VM inventory, taken from its help:
.\PCv4_VM-Inventory.ps1 -PrismCentral pc -UserName svc -Password $secure -OutputPath .\out
That client connects to Prism Central on port 9440 with basic authentication, and it probes which v4 version each API namespace serves (from v4.3 down to v4.0) and uses the newest one it finds. The documentation script tries v4.2 first, then v4.1, v4.0 and v4.3. Nutanix has since released v4.4 SDKs for cluster management, networking, prism, data protection and licensing (between August and November 2026), and the scripts don’t ask for v4.4 yet. In the other seven, every request gets an NTNX-Request-Id, and in all eight a call that comes back with HTTP 429 or a 5xx error is retried. Calls that change something return a task in v4, so the scripts wait for that task to finish before they report back (and the power-on calls send the VM’s ETag, which the v4 API expects).
The scripts that change something support -WhatIf, and the reporting scripts only read. In the seven that replace the 2016-2019 scripts, the old -nxIP, -nxUser and -nxPassword parameter names still work as aliases, so a wrapper around one of the 2019 scripts mostly keeps working (the 2016 create-VM script had no parameters at all; everything in it was hardcoded). You can pass the password as a string or as a SecureString, and I’d use Read-Host -AsSecureString for that. The documentation script keeps the parameters of v5.0, so it takes -PrismCentralIP and a -Credential object.
One thing to keep in mind: like the -AcceptInvalidSSLCerts switch of the old scripts, the v4 versions accept whatever certificate Prism Central presents. That’s handy in a lab with a self-signed certificate, but it also means the scripts won’t warn you if the certificate isn’t the one you expect.
Nutanix also publishes its own PowerShell modules on the PowerShell Gallery, such as Nutanix.Vmm (version 1.0.0, September 2026) for VM lifecycle tasks, and they run on PowerShell 7. I kept these scripts module-free so each one is a single file you can read top to bottom. If you’d rather build on a module that Nutanix maintains, start there.
Which post has which script
I ran all eight against the Prism Central in my lab, seven on 2 December 2026 and the documentation script on 3 December (for the desktop script, that’s the AHV report, as there’s no Citrix delivery controller in that run). The create scripts made test VMs, which I deleted afterward, and each post shows the output of its own run. This is what each script does now and where you’ll find the code:
| Script | What it does now | Post | Lab run, Dec 2026 |
|---|---|---|---|
| PCv4_Create-VM.ps1 | Creates an AHV VM: blank, image or cloned disk, ISO, extra disks, fixed IP | Creating a new VM (2016) | Test VM created, then deleted |
| PCv4_CreateVM-GPU.ps1 | Lists GPU profiles, or creates a VM with one | vGPU VM (2019) | 444 profiles; T4 VM created, deleted |
| PCv4_AddNicToVM.ps1 | Adds a VirtIO NIC; the VM name takes wildcards | Add a NIC (2019) | NIC added (NicCount 2) |
| PCv4_GPU-Inventory.ps1 | GPU profiles and the VMs with a GPU, to CSV | vGPU-enabled VMs (2019) | 444 profiles, 7 VMs with a GPU |
| PCv4_VM-Inventory.ps1 | VM, host and container CSV plus HTML (AHV VMs only) | VM reporting (July 2019) | 108 VMs, 8 hosts, 19 containers |
| PCv4_VM-Check.ps1 | Per-VM API checks to CSV; -GuestCheck reads the power scheme | Power settings (2019) | 111 VMs, 205 checks not passing |
| PCv4_DesktopUtilization.ps1 | Warns users of idle assigned Citrix desktops, then reclaims them in steps; AHV idle report | Citrix desktops (2017, v2) | AHV report: 111 VMs, 39 idle |
| PCv4_Documentation.ps1 | Word or PDF report of Prism Central with seven diagrams, plus JSON and mail | Documentation Script v5.0 (2026) | 18 chapters, 108 user VMs (3 Dec) |
The VM inventory replaces the script in five posts, which now all carry the same v4 version: the 2017 original, the March 2019 version that added vGPU profiles, the April update with HTML output, the June update with working set sizes and the July update with the CD-ROM column.
The desktop script is in both Citrix posts from 2017, the original and the v2 that added the reclaim step. It’s the one that changed most: it now only looks at assigned desktops, it moves an idle desktop one step per run (a mail to the user, then maintenance mode, then removal from the catalog only if you ask for it), and it sends the mail through Microsoft Graph instead of SMTP.
What isn’t in this update
The VM inventory is the one script where the v4 version does less than the last 2019 version. It only reports AHV VMs (it uses the AHV endpoints of the vmm API); it doesn’t have the working set size columns, and it counts the CD-ROMs of a VM instead of naming the mounted ISO. CPU ready is still there, now as the average over the last hour. If you need the old columns, the 2019 tab shows how they were collected, but it still needs the snap-in and the legacy APIs.
The documentation script has one fallback left. The Nutanix Documentation Script v5.0 post now has a December 2026 tab with PCv4_Documentation.ps1, which collects through v4. On my Prism Central the v4 recovery-plan list came back empty, so the script read the two existing plans from the legacy list, and the report says so. That’s the last call in these eight scripts that needs the legacy APIs; once Nutanix removes them, that chapter only shows what the v4 list returns.
Six Nutanix posts didn’t get a v4 version: the two posts on adding a persistent disk for Citrix MCS (March and November 2019), adding a CD-ROM and mounting an ISO, automating Citrix PVS, protecting Citrix desktops and recovering a Protection Domain snapshot to a VM. If you still need one of those, tell me in the comments and I’ll take it into account for the next batch.
How I’d start
- Run it with
-WhatIffirst if the script changes something. The create-VM script prints the JSON spec it would send, which is also a good way to see what the v4 API expects. - Use a service account instead of the built-in admin account, as the create-VM help also suggests.
- Keep the old tab for reference only. It’s there so you can compare the two, and I wouldn’t run it against a current cluster.
The Bottom Line
Eight of my Nutanix PowerShell scripts now run on the Prism Central v4 API, without the Nutanix snap-in.
The new versions are in the thirteen original posts, in the first tab of the code block. Each script is one file and talks to the v4 APIs; the only v3 call left is the documentation script’s recovery-plan fallback. The scripts that change something support -WhatIf, and the seven that replace the 2016-2019 scripts still accept the old -nxIP, -nxUser and -nxPassword names.
The 2016-2019 Nutanix scripts depend on the snap-in and the legacy APIs, and v5.0 of the documentation script on the legacy APIs. Nutanix lists the Q2 CY2027 releases as the last to support those APIs, so move to the v4 tab before then.
FAQ
Do the 2016-2019 scripts still work?
The Nutanix ones need the cmdlets snap-in, which only loads in Windows PowerShell, and the legacy APIs. Nutanix says the AOS and Prism Central releases targeted for Q2 CY2027 are the last to support those APIs, with removal in phases starting with the Q4 CY2027 release. The 2017 desktop script sends mail with Send-MailMessage, which Microsoft marks obsolete. I wouldn’t build anything new on them.
Do I need to install a module?
Not for the Nutanix side, although Nutanix publishes PowerShell 7 modules such as Nutanix.Vmm on the PowerShell Gallery if you’d rather use one. Each script is a single file with its own Prism Central client. PSWriteHTML is optional and only adds a tabbed HTML file to the VM inventory, and the guest check in the VM check script needs PowerShell remoting to the VMs. The Citrix part of the desktop script needs the Citrix snap-in and the ActiveDirectory module, plus Microsoft.Graph.Users.Actions if it sends mail. The documentation script needs a local Microsoft Word install for its Word or PDF output.
Does the VM inventory still report vSphere VMs?
No. The v4 version reads AHV VMs only, through the AHV endpoints of the vmm API. The 2019 version under the second tab is the one that read every VM the cmdlets returned.
Which of these scripts do you still run, and which one should be next? Drop a comment below or find me on X at @kbaggerman.
Get new posts by email
One email when a new post goes up. Nothing else.
I only use your address to send new posts, and every email has an unsubscribe link. See the privacy policy.

