Migrate VMs to another ESXi host in another Vcenter

Can across situation where I needed to move VM from one Vcenter to another.

The following script will do the following:
Will prompt for a Source and Target Vcenter and then ask for user credentials.
Connect to the Source and Target Vcenter. When then cycle through VMs listed from csv file (VMList.csv). (Place the csv file in same directory as the script.)

The list of VMs in the One by one and Migrate the VM to new VC. If the VMs powered on will attempt to shutdown the Server (if VMtools installed) and t

The format of the VMList.csv file needs to be in format as below.

#ensure that not connected to any vCenters
Disconnect-VIServer -Server * -Force -Confirm:$false

#enter Vcenter
Set-PowerCLIConfiguration -DefaultVIServerMode Multiple -Scope User -Confirm:$false
$vc1 = Read-Host "Enter Source Vcenter"
$vc2 = Read-Host "Enter Target Vcenter"

Write-Host "VC1 = " $vc1
Write-Host "VC2 = " $vc2

$vmlist = Import-CSV “$pwd\VMList.csv”

# Connect To Vcenter Server
$User = Read-Host -Prompt "Please enter your VC admin username"
$PW = Read-Host -Prompt "Please enter your VC admin password" -asSecureString
$PW = [Runtime.InteropServices.Marshal]::PtrToStringAuto([Runtime.InteropServices.Marshal]::SecureStringToBSTR($PW))

Connect-VIServer $vc1 -User $User -Password $PW -ErrorAction SilentlyContinue
Connect-VIServer $vc2 -User $User -Password $PW -ErrorAction SilentlyContinue

foreach ($item in $vmlist) {
# Map variables
$vm = $item.vmName
$destESXi = $item.targetesxihost
$destDatastore = $item.targetdatastore
$destVDSwitch = $item.targetDVSwtich
$destPortgroup= $item.targetPortGroup
$typeDisk = $item.Disktype

$vm = get-vm $vm
#Check to see if VM powered off if powered on will shutdown and check ever 5 sec til shutdown
if ($vm.powerstate -eq "PowerdOn"){
write-host "Shutting down" $vm
$vm | Shutdown-VMguest -Confirm:$false
do {
#wait 5 secs
start-Sleep -s 5
$vm = get-vm $vm
$status = $vm.powerstate
}until($status -eq "PoweredOff")
}

Write-Host "===== Connected vCenters ====="
$global:DefaultVIServers | ft -AutoSize

#Command to migrate the VM to new Host in new Vcenter
Write-Host "Moving VM" $vm
Move-VM -VM (Get-VM -Server $vc1 -Name $vm) -VMotionPriority High `
-Destination (Get-VMHost -Server $vc2 -Name $destESXi) `
-Datastore (Get-Datastore -Server $vc2 -Name $destDatastore) -DiskStorageFormat $typeDisk `
-PortGroup (Get-VDPortgroup -Server $vc2 -VDSwitch $destVDSwitch -Name $destPortgroup)

} #end of ForLoop

Disconnect-VIServer -Server * -Force -Confirm:$false

Amazon Fire TV Cube after one week

After little over a week of using the Amazon Fire TV Cube. I’ve been very happy with it my purchase so far. By far from control perspective I really love how the voice command to turn on and off my TV/Sound bar works very well without use of a remote. It does a good job launching applications via voice but I’ve seen voice commands within the app is not as great. For pausing and restarting video works good. But asking it to play a specific TV series in Hulu for example (when there are multiple user profiles requires interaction with remove to select profile and sometimes locate the TV show. It does a great job controlling my netgear arlos cameras, and all the other smart devices in the home.

Some of features that I feel that this device is lacking is the ability to control off the air TV antenna (don’t have cable to use voice command to control cable box). I also wish that it had full features of a typical echo, such as drop (to use as home intercom system). In addition to improvements anytime you issue your voice command it will pause the Video that you are playing (lets say that you want volume up or down) it will pause the video and adjust the volume and then continue. This may be something I just need to get use to not issue just a little annoying.

Overall I would recommend this to anyone especially those who have an older Fire TV (I had the original Fire TV), and those who don’t want a dongle and device with more horse power than a fire TV Stick. For controlling a main TV/Sound bar in living its great feature to be able to control with voice. As the most importing approval the wife seems also to embrace the device for her approval too.

New Amazon Fire TV Cube

Amazon has new Fire TV device called the Fire TV Cube.  I Pre-Ordered mine today for $89.99.  I’m an owner of the original Fire TV for my main TV in our house.  I’ve wanted to upgrade my Fire TV for quite some time b/c it was lacking many of the features that the Fire TV 4k had to offer but I did not want a dongle hanging from my TV but rather a piece of hardware that  had more horse power and performance like the original Fire TV had vs the Fire TV Stick.

The retail price of this unit is $119.99 but if you pre-order you can get it now for $89.99.  The ship date for this new device is June 21st.

Here is full description of the product from Amazon site:

  • Fire TV Cube is the first hands-free streaming media player with Alexa, delivering an all-in-one entertainment experience. From across the room, just ask Alexa to turn on the TV, dim the lights, and play what you want to watch.
  • With far-field voice recognition, eight microphones, and beamforming technology, Fire TV Cube hears you from any direction. Enjoy hands-free voice control—search, play, pause, fast forward, and more. Plus, control your TV, sound bar, cable or satellite box, receiver, and more with just your voice.
  • Do more with Alexa. Fire TV Cube has a built-in speaker that lets you check the weather, listen to the news, control compatible smart home devices, and more—even with the TV off. Fire TV Cube is always getting smarter with new Alexa skills and voice functionality.
    Experience true-to-life picture quality and sound with access to vivid 4K Ultra HD up to 60 fps, HDR, and the audio clarity of Dolby Atmos.
  • Enjoy tens of thousands of channels, apps, and Alexa skills. Get over 500,000 movies and TV episodes from Netflix, Prime Video, Hulu, HBO, SHOWTIME, NBC, and more.
  • Access YouTube, Facebook, Reddit, and more websites with Silk and Firefox browsers.

Rolling Reboot of VMware ESXi Cluster

Ran into situation where I needed to reboot a full cluster of ESXi hosts. In most cases when I need to reboot Cluster full of hosts I would utilize VUM (VMware Update Manager) to use VMware DRS to move VMs off the host, place the host in maintenance mode, reboot host and when host completes the reboot take server back out of maintenance mode, then move to next host and does for each host in cluster.

I did not need to patch the hosts this time. And Since the cluster had 32 hosts and several VMs I did not want to do this by hand. So used google and was found this script that I wanted to share. I wish I could give credit to the creator but the was on in an archived word press blog.

The script does the following:
Goes through the cluster one host at a time and puts ESXi server maintenance mode, reboots the server and the puts it back online. If VMs are running on the host DRS will need to be enabled in fully automated mode to allow VMs to VMotion off to other hosts (There should also be enough HA capacity in cluster to have 1 host taken offline at a time.

###################
## reboot-vmcluster.ps1 
## Supply the hostname/FQDN for you vcenter server and the name of the cluster you want rebooted
## Script reboots each ESXi server in the cluster one at a time
###################
##################
## Args
##################
# Check to make sure an argument was passed
if ($args.count -ne 2) {
Write-Host “Usage: reboot-vmcluster.ps1 ”
exit
}

# Set vCenter and Cluster name from Arg
$vCenterServer = $args[0]
$ClusterName = $args[1]

##################
## Connect to infrastructure
##################
Connect-VIServer -Server $vCenterServer | Out-Null

##################
## Get Server Objects from the cluster
##################
# Get VMware Server Object based on name passed as arg
$ESXiServers = @(get-cluster $ClusterName | get-vmhost)

##################
## Reboot ESXi Server Function
## Puts an ESXI server in maintenance mode, reboots the server and the puts it back online
## Requires fully automated DRS and enough HA capacity to take a host off line
##################
Function RebootESXiServer ($CurrentServer) {
# Get Server name
$ServerName = $CurrentServer.Name

# Put server in maintenance mode
Write-Host “#### Rebooting $ServerName ####”
Write-Host “Entering Maintenance Mode”
Set-VMhost $CurrentServer -State maintenance -Evacuate | Out-Null

$ServerState = (get-vmhost $ServerName).ConnectionState
if ($ServerState -ne “Maintenance”)
{
Write-Host “Server did not enter maintanenace mode. Cancelling remaining servers”
Disconnect-VIServer -Server $vCenterServer -Confirm:$False
Exit
}
Write-Host “$ServerName is in Maintenance Mode”

# Reboot blade
Write-Host “Rebooting”
Restart-VMHost $CurrentServer -confirm:$false | Out-Null

# Wait for Server to show as down
do {
sleep 15
$ServerState = (get-vmhost $ServerName).ConnectionState
}
while ($ServerState -ne “NotResponding”)
Write-Host “$ServerName is Down”

$j=1
# Wait for server to reboot
do {
sleep 120
$ServerState = (get-vmhost $ServerName).ConnectionState
Write-Host “… Waiting for reboot”
$j++
}
while ($ServerState -ne “Maintenance”)
$RebootTime=$j/2
Write-Host “$ServerName is back up. Took $RebootTime minutes”

# Exit maintenance mode
Write-Host “Exiting Maintenance mode”
Set-VMhost $CurrentServer -State Connected | Out-Null
Write-Host “#### Reboot Complete####”
Write-Host “”
}

##################
## MAIN
##################
foreach ($ESXiServer in $ESXiServers) {
RebootESXiServer ($ESXiServer)
}

##################
## Cleanup
##################
# Close vCenter connection
Disconnect-VIServer -Server $vCenterServer -Confirm:$False

Example of Script Output:

>.\reboot-vmcluster.ps1 vcenter.domain.com demo-cluster
#### Rebooting esxi06.domain.com ####
Entering Maintenance Mode
Rebooting
esxi06.domain.com is Down
Waiting for Reboot ...
Waiting for Reboot ...
Waiting for Reboot ...
esxi06.domain.com is back up
Exiting Maintenance mode
#### Reboot Complete####


#### Rebooting esxi05.domain.com ####
Entering Maintenance Mode
Rebooting
esxi05.domain.com is Down
Waiting for Reboot ...
Waiting for Reboot ...
Waiting for Reboot ...
Waiting for Reboot ...
esxi05.domain.com is back up
Exiting Maintenance mode
#### Reboot Complete####

Dashlane the perfect password manager for me!

DashLaneMany people have asked me which password manager do I use? I’ve been using Dashlane password manager since 2014. I first started using Dashlane’s free version of the product. (which it allows password managment on a single device) Shortly I discovered the value of having passwords synced across all my devices (mobile and multiple desktops).

Never forget another password.
Add or import passwords, or save them as you browse the web. However you get them in Dashlane, you’ll never lose track of them again.

Never forget another password.
Never type another password.
Dashlane’s powerful autofill types your passwords on any website

Password autofill
Never type another password.
Instant security alerts.
Instant security alerts are sent straight to your computer or phone when sites suffer breaches.

Security alerts
Instant security alerts.
Generate strong passwords.
Dashlane’s strong password generator creates and saves passwords right on the web.

Strong password generator
Generate strong passwords.
Auto-change passwords in a click (or a tap).
Our one-and-only Password Changer updates passwords instantly and with the touch of a button.

Password Changer
Have your passwords, wherever you go.
Dashlane backs up your passwords and keeps them up to date across your phone, computer or tablet.

Secure backup and sync
Have your passwords, wherever you go.