Nutanix PowerShell and Other Scripting Resources

Here are some helpful resources for scripting to the Nutanix API via PowerShell or other languages. I’ll continue to add more as I come across them. Feel free to leave your favorite resources in the comments section below! 🙂

https://portal.nutanix.com/#/page/docs/details?targetId=API_Ref-Acr_v4_5:PowerShell_Cmdlets_Reference
Cmdlets references with clickable links on each cmdlet that shows syntax

http://go.nutanix.com/rs/031-GVQ-112/images/Powershell_Automation_Poster.pdf
Cmdlet poster so you can decorate your cube with it 🙂 

http://nutanixbible.com/#anchor-powershell-cmdlets-38
Cmdlet “how to” on the Bible and some other examples

http://next.nutanix.com/t5/Scripts/bd-p/ScriptsGitHub
Scripts and other posts on the Community Forum 

https://github.com/nutanix
Github repository with scripts (some PowerShell, some others)

How-to Flush DNS on Mac OS X

About the DNS cache

OS X keeps a local cache of resolved DNS queries for a time defined by the DNS server. Sometimes it might be necessary to reset the cache immediately and re-query a DNS server. For example, you might need to do this if you are a network or server administrator and an entry on your DNS server has recently changed.

If your Mac isn’t using the latest DNS entries from your server, you can restart your Mac to update its cached information. If you need to update DNS entries on a server using OS X and you can’t restart the server, use the terminal commands below for the version of OS X you’re using.

OS X Yosemite, El Capitan and later

Use the following Terminal command to reset the DNS cache in OS X v10.10.4 or later:

sudo killall -HUP mDNSResponder

Use the following Terminal command to reset the DNS cache in OS X v10.10 through v10.10.3:

sudo discoveryutil mdnsflushcache

OS X Mavericks, Mountain Lion, and Lion

Use the following Terminal command to reset the DNS cache in OS X v10.9.5 and earlier:

sudo killall -HUP mDNSResponder

Mac OS X Snow Leopard

Use the following Terminal command to reset the DNS cache in OS X v10.6 through v10.6.8:

sudo dscacheutil -flushcache

Migrate a Windows VM from VMware ESXi to Acropolis Hypervisor (AHV) Easily

Moving VM’s from ESXi to the Acropolis Hypervisor (AHV) is quite simple. Here are the high-level steps:

  • First, install the Nutanix VirtIO package into the VM(’s) you are moving – driver package can be downloaded here: https://s3.amazonaws.com/ntnx-portal/mobility/1.0.1/Nutanix-VirtIO-1.0.1.msi (or find the latest on the http://portal.nutanix.com site)
  • Whitelist the subnet (In Prism, Gear icon -> Filesystem Whitelists) so that we can access the Nutanix Distributed Storage Container from any host
  • Mount it as an NFS mount (ESX) or as a SMB Shared Path (Hyper-V) on the hypervisor hosts you are coming “from”
  • Power-off the Source VM
  • Clone or Move (your choice) the Source VM onto the shared storage container
  • Create a new VM in Prism and specify CPU, RAM and add a NIC/vLan adapter
  • To add a disk, configure it as follows:
    • Type: Disk
    • Operation: Clone from ADSF file
    • Bus Type: SCSI
    • Path: provide the path to the VM’s Flat VMDK file. To see options, type / to start the autocomplete dropdown
  • Once VM is configured, power-on and it should boot right up

Here’s also a helpful blog post that shows the above with a video:
http://vmwaremine.com/2015/08/27/migrate-windows-2012r2-server-from-esxi-to-ahv/#sthash.fC2IASXj.UJAlw4ov.dpbs

Hope it helps and happy converting! 😉

Upgrading the VAAI Plugin for ESX vSphere in a Nutanix Environment

Usually the latest VAAI plugin version is installed/updated along with our Foundation or upgrade process, but if you need to update the VAAI plugin version, just run this simple command from any Controller VM (CVM):

for i in `hostips`; do echo $i; scp \
~/data/installer/*4.0*/pkg/nfs-vaai-plugin.vib root@$i:/var/tmp/; \
echo "about to install"; ssh root@$i "esxcli software vib install -v \
/var/tmp/nfs-vaai-plugin.vib -f"; done