Using PowerCLI To Answer Virtual Machine Message Questions

pic1

 

 

 

 

 

 

 

The Virtual Machine Message I’m faced with deals with the relocation of the VM.  Via the vSphere Client, my possible choices to answer the question are “Cancel”, “I moved it”, or “I copied it”.  I don’t have the patience or desire to mouse through this hundreds of times.

pic2

 

 

 

 

 

I want to provide the same answer, “I moved it”, for every VM in inventory which has this question.  The script to accomplish this is fairly simple, even by my standards.  Once the PowerCLI connection is established to the vCenter Server or ESX(i) host, it’s a one-liner.  Following is the PowerShell script which gets the job done for my situation:

Connect-VIServer vc501.boche.lab
Get-VM | Get-VMQuestion | Set-VMQuestion -Option “I moved it” -Confirm:$false

Note that there are different types of Virtual Machine Message questions which will yield a different set of possible answers.  Be sure to query a VM having a question via PowerCLI for the possible answers to that question.  Get-VM | Get-VMQuestion -full should do it.  Once the possible answers are revealed, use Set-VMQuestion -Option to provide an answer.

Also note the script above will cycle through all VMs in inventory, and for those having a question, it will provide the same response for each VM.  Thus the assumption is made that all VMs with pending questions have the same question being asked.  To respond to explicit question types or to filter the VMs being looped through, the script would need to be refined.

For more information on the Get-VMQuestion or Set-VMQuestion PowerCLI cmdlets, use Get-Help Get-VMQuestion -full or Set-Help Get-VMQuestion -full respectively.

Thank you to Jason Boche for this article

Continue Reading

Multiple commands in Linux

For those that do not know how to string multiple commands together, here is a quick reference for you:

[user@server foobar]$ command1 ; command2

The command is executed in the order it was written, but command 2 is executed even if there was an error in command 1.

[user@server foobar]$ command1 && command2

The command command2 is executed only if command1 was successful, no errors.

 

Continue Reading

Configuring additional ETH interfaces in CentOS

Assuming you already have an ETH0 configured and working, log in at the console and configure it just like a normal RHEL/CentOS nic configuration:

  1. cp /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth1
  2. vim /etc/sysconfig/network-scripts/ifcfg-eth1
    1. Update the ETH # to the next in line.  (ETH0 to ETH1…)
    2. Update the correct IP & Subnet
    3. :wq
  3. service network restart
  4. run ifconfig to ensure the settings have taken effect
Continue Reading

MacMini Wireless AirPort disconnecting randomly or after sleep

This is what solved my problems with WiFi disconnecting randomly, not appearing after awakening, etc.

1. Open network preferences from your WiFi icon in the menu bar. Then click advanced. Delete the network that is giving you problems.

2. Open Keychain in the utilities folder of your hard drive. Find the passwords that are stored for your particular network and delete them. There may be multiple passwords for your network, so search carefully.

3. Repair permissions using the disk utility.

4. Reboot the computer.

5. Reenter your network data to log into the network.

Continue Reading