Answer Challenge questions after a datastore reaches 100% used

I’ve run into this issue a few times and with the amount of VMs that are typically on the datastores that reach 100% usage, it comes in handy to have a way to mass answer a challenge question.

**Please note that these scripts are just for reference – use at your own risk** – Standard disclaimer 🙂


##--Use the commented out lines if you haven't connected to a vC yet--##

##$cred = Get-Credential -Message "vCenter or esxi username and password"
##Connect-Viserver vcenterserver -Credential $cred

get-datastore "*" | get-vm "*" | get-vmquestion | Set-VMQuestion -Option "Retry"

Set-VMQuestion -VMQuestion $question -Option "Retry"

To break down the above:

Get-datastore “*” will select any datastore presented to the vC you connect to. You can replace the * with a datastore name to target just the 1 datastore that might be full or have VMs on it with challenge questions.

Get-VM “*” again will target any VM with a challenge question on it. This can be replaced with a full VM name or with a partial like “vc*” to target any VM starting with vc.

This script tells the question to “Retry”. There are other answers but for my need I answer “Retry” after freeing up space on the full datastore. This will then allow your VMs to be able to write to their virtual disks.

 

**Please note that these scripts are just for reference – use at your own risk** – Standard disclaimer 🙂

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s