Saturday, 26 September 2015

Nutanix cmdlets and PowerCLI One Liners and then some [Updated]

I really like powershell but I never used it to its full potential. A recent change in job role sees me more involved in the day to day stuff so I started brushing up on my coding skills. I will be sharing some of the code I find useful. I still consider myself a novice so don't expect anything fancy but please share your thoughts, I would love to learn from your experiences.

Stop a protection domain replication


This one liner returns all replications
Get-NTNXProtectionDomainReplication | Select ProtectionDomainName, ID
The above command will return the name and ID of the replication. You will need to specify these when you want to stop the replication
Abort-NTNXProtectionDomainReplication -ProtectionDomainName PD1 -ID 1234567

Using PowerCLI and vSphere tags for VM lifecycle


VM sprawl can get seriously out of control. I recently deleted 50 VM in an environment after it appeared they were no longer required or worse, nobody knew what they were used for. Read More

Find unprotected VM on your Nutanix cluster


This one liner returns which VM are currently not protected.
Get-NTNXUnprotectedVM | Select vmName

List protected VM in a protection domain


This one liner lists all VM in a given protection domain
Get-NTNXVM  | where {$_.protectiondomainame -eq "My_PD"} | Select vmname

Add unprotected VM to a protection domain


This one liner adds a VM to a protection domain
Add-NTNXProtectionDomainVM  -name "My_PD" -names "VM1"

Remove protected VM from a protection domain


This one liner removes a VM from a protection domain
Remove-NTNXProtectionDomainVM  -name "My_PD" -input "VM1"

Configuring the scratch partition


Configure the scratch partition of your ESXi host when making use of a SD install Read More
Disclaimer: Please use examples at your own risk. I take no responsibility for any possible damage to your infrastructure.

No comments:

Post a comment