Building a Horizon View vCheck (part 3)

So it’s time for part 3 already of building checks for Horizon View. I got some remarks after last post and thus I need to say that the checks have been created for View 7 because some commands might not work against a 6.* installation. three new plugins this time or actually two since one was already in the original uploads on github but I didn’t mention it on here yet.

11 Linked Clone Desktop Pool Information.ps166

Just like the full clone pool information but tailored for linked pools.

# Start of Settings
# End of Settings

[email protected]()
foreach ($pool in $pools){
$poolname=$pool.base.name
if ($pool.type -like "*automated*" -AND $pool.source -like "*VIEW_COMPOSER*"){
$desktops=get-hvmachinesummary -pool $poolname
$automatedpoolstatus+=New-Object PSObject -Property @{"Name" = $Poolname;
								"Pool_Image" = $pool.automateddesktopdata.VirtualCenternamesdata.parentvmpath;
								"Pool_Snapshot" = $pool.automateddesktopdata.VirtualCenternamesdata.snapshotpath;
								"Desktop_Count" = ($desktops).count;
								"Available" = ($desktops | where {$_.base.basicstate -eq "AVAILABLE"}).count;
								"Connected" = ($desktops | where {$_.base.basicstate -eq "CONNECTED"}).count;
								"Disconnected" = ($desktops | where {$_.base.basicstate -eq "DISCONNECTED"}).count;
								"Maintenance" = ($desktops | where {$_.base.basicstate -eq "MAINTENANCE"}).count;
								"Provisioning" = ($desktops | where {$_.base.basicstate -eq "PROVISIONING"}).count;
								"Customizing" = ($desktops | where {$_.base.basicstate -eq "CUSTOMIZING"}).count;
								"Already_Used" = ($desktops | where {$_.base.basicstate -eq "ALREADY_USED"}).count;
								"Agent_Unreachable" = ($desktops | where {$_.base.basicstate -eq "AGENT_UNREACHABLE"}).count;
								"Error" = ($desktops | where {$_.base.basicstate -eq "ERROR"}).count;
								"Deleting" = ($desktops | where {$_.base.basicstate -eq "DELETING"}).count;
								"Provisioning_Error" = ($desktops | where {$_.base.basicstate -eq "PROVISIONING_ERROR"}).count;
}
}
}
$automatedpoolstatus | select Name,Pool_Image,Pool_Snapshot,Desktop_Count,Available,Connected,Disconnected,Maintenance,Provisioning,Customizing,Already_Used,Agent_Unreachable,Error,Deleting,Provisioning_Error
$Title = "Linked Clone Desktop Pool Status"
$Header = "Linked Clone Desktop Pool Status"
$Comments = "These are the pools that have floating linked clones. Not all but the most common status's are counted."
$Display = "Table"
$Author = "Wouter Kursten"
$PluginVersion = 0.1
$PluginCategory = "View"

13 Dedicated Full Clones Assignment.ps1

This plugin is targeted at the dedicated full clones (and I just realize that one can also have dedicated linked clones so will need to build one for that as well). It gives information about which desktop is assigned to which account but also with information about the host it is running on if this information is available (not in my case).

# Start of Settings
# End of Settings

[email protected]()
foreach ($pool in $pools){
$poolname=$pool.base.name
if ($pool.type -like "*automated*" -AND $pool.source -like "*VIRTUAL_CENTER*"){
	$desktops=get-hvmachinesummary -pool $poolname
	foreach ($desktop in $desktops){
	if ($desktop.namesdata.username){
		$username=$desktop.namesdata.username
		}
	else{
		$username="Unassigned"
		}
$fulldesktopassignment+=New-Object PSObject -Property @{"Pool_Name" = $Poolname;
								"Desktop_Name" = $desktop.base.name;
								"Desktop_State" = $desktop.base.basicstate;
								"Desktop_Assigned_to" = $username;
								"Desktop_OperatingSystem" = $desktop.base.Operatingsystem;
								"Agent_version" = $desktop.base.agentversion;
								"Host" = $desktop.managedmachinesdata.hostname;
								"Datastore" = $desktop.ManagedMachineNamesData.datastorepaths | out-string;
}
}
}
}
$fulldesktopassignment | select Pool_Name,Desktop_Name,Desktop_State,Desktop_Assigned_to,Desktop_OperatingSystem,Agent_version,Host,Datastore
$Title = "Dedicated Desktop Pool Assignment"
$Header = "Dedicated Desktop Pool Assignment"
$Comments = "These are the dedicated desktops with their current user assignment"
$Display = "Table"
$Author = "Wouter Kursten"
$PluginVersion = 0.1
$PluginCategory = "View"

04 License Status.ps1

This plugin gives licensing information including expiration date and what techniques are allowed under this license.

# Start of Settings
# End of Settings

[email protected]()

$license=($services1).license.license_get()
$licensestatus+=New-Object PSObject -Property @{"Licensed" = $license.Licensed;
								"LicenseKey" = $license.LicenseKey;
								"ExpirationTime" = $license.ExpirationTime;
								"ViewComposerEnabled" = $license.ViewComposerEnabled;
								"DesktopLaunchingEnabled" = $license.DesktopLaunchingEnabled;
								"ApplicationLaunchingEnabled" = $license.ApplicationLaunchingEnabled;
								"InstantCloneEnabled" = $license.InstantCloneEnabled;
								"UsageModel" = $license.UsageModel;
}								

$licensestatus | select Licensed,LicenseKey,ExpirationTime,ViewComposerEnabled,DesktopLaunchingEnabled,ApplicationLaunchingEnabled,InstantCloneEnabled,UsageModel

$Title = "License Status"
$Header = "License Status"
$Comments = "This is the license status information"
$Display = "Table"
$Author = "Wouter Kursten"
$PluginVersion = 0.1
$PluginCategory = "View"

Welcome to my first sponsor: Vembu

I am proud to announce the first sponsor of Retouw.nl: Vembu. Vembu is the creator of the Backup & DR suite with the same name. Besides that they also have a CRM suite in their portfolio. I have created a new partner page for them.

About Vembu

Vembu is a leading provider of a portfolio of software products and cloud services to small and medium businesses for more than a decade. Vembu’s vision is to make software and cloud services very affordable for the hundreds of thousands of small and medium businesses worldwide.

Vembu’s flagship offering is the BDR Suite of products meant for on-premise, offsite, cloud backup and disaster recovery across diverse IT environments including physical, virtual, applications and endpoints. Vembu CRM Suite consists of products that addresses the needs of all customer facing teams including support, sales, marketing & social media engagement.

Since 2002, Vembu’s industry-recognized data protection solutions have delivered tangible value to more than 60,000 businesses worldwide through a network of 4000+ partners (MSPs/VARs & Resellers).

The different products under Vembu BDR Suite are categorized on the basis of environments:

For Virtualized environments like VMware vSphere and Microsoft Hyper-V:

Vembu VMBackup, part of Vembu BDR Suite provides reliable, efficient, agentless VMware vSphere and Microsoft Hyper-V backups for small and medium businesses with enterprise level features at affordable pricing. With Round-the- clock Business Availability as its sole aim, Vembu VMBackup provides faster recovery options which ensures that the business continuity is not disrupted. With VM Replication for High Availability, Vembu CBT Driver for high performance incremental backups, VSS aware technology for application consistency, Automated Backup Verification, VembuHIVE File System, a File System of File Systems for efficient backup storage, Multiple migration options, Flexible & Configurable Retention Policies, Vembu VMBackup is tailor made for all Backup & DR requirements of a complete virtual Datacenter. Also, to empower small businesses to have business continuity, Vembu provides 50% discount on Vembu VMBackup for small businesses having up to 6 CPU-Sockets

For Windows IT environments:

Vembu ImageBackup, part of Vembu BDR Suite is a complete backup and disaster recovery solution for Windows IT environments. It provides an option to do entire system level backup or specific file level backup in Windows Servers and workstations. It also ensures RTO less than 15 minutes by delivering reliable recovery options like Bare Metal Recovery, Quick VM Recovery, Instant File Recovery, Partition level Recovery etc. Furthermore, Desktops/Laptops Backup is completely free.

For Applications, File Servers, Endpoints:

Vembu NetworkBackup, part of Vembu BDR Suite is designed for small medium businesses to protect business data across file servers, application servers, workstations and other endpoints. With NetworkBackup businesses can backup all their systems to a central location which is easier to manage.

Vembu OnlineBackup, part of Vembu BDR Suite provides File Server, MS Exchange, MS SQL, MS SharePoint & MS Outlook Backups directly to Vembu’s secure cloud using enterprise-grade AES 256-bit encryption with granular restores.

For SaaS applications like Microsoft Office365 and G Suite:

Vembu SaaSBackup, part of Vembu BDR Suite is designed for backing up the Mails, Drives, Calendar and Contacts of Office 365 and Google Apps. Vembu SaaSBackup’s core system will manage all backup and restore operations as per the user request. The backup data will be sent to the Vembu Cloud storage over secured network.

Free version

Vembu also offers a free version that has many great features. The paid version has even more very usable features that you can see in the comparison.

Building a Horizon View vCheck (part 2)

So last time I created some simple scripts for the Horizon View vCheck. This time I wanted to add some information about the Composer, Connection, security servers and the event database. So all in all I added four scripts that might seem to do the same but since the api’s treat the types of servers differently I decided to make separate scripts as well.

Please pull the scripts from Github since by the time you read this post things might have changed.

05 Connection Servers Status.ps1

This plugin pulls some information about the connection servers, if the status is ok and gives a warning if the Certificate will expire within 30 days. This period is something I need to change in the future to a setting so it will be customizable.

# Start of Settings
# End of Settings

$date=get-date
$datemaxexp=(get-date).adddays(30)
[email protected]()
$conservers=$services1.connectionserverhealth.connectionserverhealth_list()
foreach ($conserver in $conservers) {
if ($conserver.CertificateHealth.ExpirationTime -lt $date){
$expiring="Already Expired"
}
elseif ($conserver.CertificateHealth.ExpirationTime -lt $datemaxexp){
$expiring="Expiring in 30 days"
}
else {
$expiring="False"
}

$conserverstatus+=New-Object PSObject -Property @{"Name" = $conserver.name;
								"Status" = $conserver.Status;
								"Version" = $conserver.Version;
								"Build" = $conserver.Build
								"Certificate_Status" = $conserver.CertificateHealth.Valid;
								"Certificate_Expiration_Time" = $conserver.CertificateHealth.ExpirationTime;
								"Certificate_Expiring" = $expiring;
								"Certificate_Invalidation_Reason" = $conserver.CertificateHealth.InValidReason;
								
}
}
$conserverstatus | select name,Status,Version,Build,Certificate_Status,Certificate_Expiring,Certificate_Expiration_Time,Certificate_Invalidation_Reason 

$Title = "Connection Servers Status"
$Header = "Connection Servers Status"
$Comments = "These are the used Connection Servers"
$Display = "Table"
$Author = "Wouter Kursten"
$PluginVersion = 0.1
$PluginCategory = "View"

06 Security Servers Status.ps1

Almost the same as the connection servers but this time it checks for the security servers. I don’t run the appliance yet so will need to check on those somewhere as well.

# Start of Settings
# End of Settings

$date=get-date
$datemaxexp=(get-date).adddays(30)
[email protected]()
$secservers=$services1.securityserverhealth.securityserverhealth_list()
foreach ($secserver in $secservers) {
if ($secserver.CertificateHealth.ExpirationTime -lt $date){
$expiring="Already Expired"
}
elseif ($secserver.CertificateHealth.ExpirationTime -lt $datemaxexp){
$expiring="Expiring in 30 days"
}
else {
$expiring="False"
}

$secserverstatus+=New-Object PSObject -Property @{"Name" = $secserver.name;
								"Status" = $secserver.Status;
								"Version" = $secserver.Version;
								"Build" = $secserver.Build
								"Certificate_Status" = $secserver.CertificateHealth.Valid;
								"Certificate_Expiration_Time" = $secserver.CertificateHealth.ExpirationTime;
								"Certificate_Expiring" = $expiring;
								"Certificate_Invalidation_Reason" = $secserver.CertificateHealth.InValidReason;
								
}
}
$secserverstatus | select name,Status,Version,Build,Certificate_Status,Certificate_Expiring,Certificate_Expiration_Time,Certificate_Invalidation_Reason 

$Title = "Security Servers Status"
$Header = "Security Servers Status"
$Comments = "These are the used Security Servers"
$Display = "Table"
$Author = "Wouter Kursten"
$PluginVersion = 0.1
$PluginCategory = "View"

07 Composer Servers Status.ps1

Strangely enough the composer server doesn’t have a status in the api’s. I would have expected at least something for it being available or not. Because of this I only added information and the vCenter server it is connecting to. Another weird thing (might be me offcourse) is that the vcentername actually gives a plural output even though composer and vCenter have a 1on1 relation,

# Start of Settings
# End of Settings

[email protected]()
$comservers=$services1.viewcomposerhealth.viewcomposerhealth_list()
foreach ($comserver in $comservers) {
$vcenters=$comserver.data.virtualcenters

foreach ($vcenter in $vcenters){
if ($vcenternames){
$vcenternames+=","
$vcenternames+=($services1.virtualcenterhealth.virtualcenterhealth_get($vcenter)).data.name
}
else{
$vcenternames+=($services1.virtualcenterhealth.virtualcenterhealth_get($vcenter)).data.name
}
}
$comserverstatus+=New-Object PSObject -Property @{"Name" = $comserver.ServerName;
								"Version" = $comserver.Data.Version;
								"Build" = $comserver.Data.Build;
								"vCenter_Server"= $vcenternames
								
}
}
$comserverstatus | select name,Version,Build,vcenter_server

$Title = "Composer Servers Status"
$Header = "Composer Servers Status"
$Comments = "These are the used Composer Servers"
$Display = "Table"
$Author = "Wouter Kursten"
$PluginVersion = 0.1
$PluginCategory = "View"

08 Event Database Status.ps1

For the event database I decided to give as much information as possible from the api’s. Maybe in the future it could pull some information from the sql server itself but I think that should be covered by a sql check.

# Start of Settings
# End of Settings


[email protected]()
$eventdb=$services1.EventDatabaseHealth.EventDatabaseHealth_get()
if ($eventdb.configured -eq $True){
$eventdbstatus+=New-Object PSObject -Property @{"Servername" = $eventdb.data.Servername;
								"Port" = $eventdb.data.Port;
								"Status" = $eventdb.data.State;
								"Username" = $eventdb.data.Username;
								"DatabaseName" = $eventdb.data.DatabaseName
								"TablePrefix" = $eventdb.data.TablePrefix;
								"State" = $eventdb.data.State;
								"Error" = $eventdb.data.Error;
}
}
$eventdbstatus | select Servername,Port,Status,Username,DatabaseName,TablePrefix,State,Error 

$Title = "Event Database Status"
$Header = "Event Database Status"
$Comments = "These are the settings for the Event Database"
$Display = "Table"
$Author = "Wouter Kursten"
$PluginVersion = 0.1
$PluginCategory = "View"

The result

Updated flings for Horizon View

The last couple of weeks some of the flings applicable for Horizon View and that I had in my VMUG presentation have been updated. The Horizon Toolbox 2 has been updated so it now supports console access for vCenter 6.0u2 and 6.5 + it now supports horizon 7.1. The Horizon OS Optimization Tool got several bugfixes.

Recent change for the Horizon Toolbox 2:

2017-Mar-17 Horizon Toolbox 2.1.3

New Features

  • Support new Horizon version(7.1)
  • Support new VCenter version(VC6.5 and 6.0u2a) in Console Access feature

 

Recent changelog for the OSOT:

April 27, 2017 b1090b

  • Issue Fix: “the node to be removed is not a child of this node” when opitimize windows 10 template
  • Issue Fix: System.NullReferenceException occurs if the network can’t reach any of the public template repository.
  • Template Update (Windows 7/8/8.1): Correct the Menu Show Delay type to REG_SZ in item “Reduce Menu Show Delay”

April 18, 2017

Issue fixed

    • Some optimization items are skipped mistakenly. For example, Remote Apps in Windows 10 template. This is caused by a recent change in Conditional Check feature.

April 17, 2017 b1088

Feature

      • Conditional Check: you can specify on what condition an optimization should be run. For example, when a specific registry key match certain value.

Template

      • “Change Explorer Default View” has been changed to unselected by default, because of conflict to UEM. Details: it causes the locations in “user files” (desktop, downloads, favorites, music, videos , Documents, Pictures) folder is to the local drive c:\Users\Username, its Should be \\server\folder_redirection\%username% when use UEM folder redirection.

Enhancements

      • Public Templates tab: click template on the list is very slow, which should not be
      • Default public template repository URL updated
      • Loading public template repository takes too long

Issue Fix

    • Field validation: prevent user from creating template with blank name

VMworld EU here I come!

Wow just wow, it just got announced that I will be going to VMworld for a second time. Last year my boss let me choose what edition to go to so I ended up in Vegas for the first time. This year I have won a ticket in the Dutch VMUG Usercon lottery by VMware Netherlands (for DUtch readers: https://t.co/1L1YAq7PiX ). After the event three potential winners were announced and we had to write a motivation piece why we needed to win the ticket.

I decided to write my piece about how vExperts just belong at VMworld but also what the VMworld experience is about for me: networking with peers, customers and suppliers and gaining knowledge. Another thing I promised is blogging about the event, last year I did daily blogs about what happened the afternoon and night before and the morning of the current day. I am not sure yet how I will do it this year but it might be the same principle because writing a blog after a party late in the evenings might prove to be difficult.

Another thing I mentioned is doing a vBrownbag again. For this I have absolutely no idea yet on the content but there’s quite a few months left so something will pop up in my mind.

So in short: I’ll see you all in Barcelona this year!

Using PowerCLI to get Horizon view status & events

Update: There is a new way to pull the event information without having to enter the sql password please see this post about it.

So two weeks ago I had a nice little post about talking to Horizon View using PowerCLI. I also promised to be digging a bit more into PowerCLI by grabbing the script posted on the VMware blog and editing it a little to my taste. It’s a very useful script they have on there but still I prefer to know what might have caused the issues. I decided I needed to know who the last user was that used the desktop and the last entry into the eventlog and the time of that log. So actually most code used talks to the eventlog database, something already available pre PowerCLI 6.5 but what I hardly ever used.

The basics for connecting I won’t post but we do need an extra connection and that is to the event database:

$eventdb=connect-hvevent -dbpassword $hvedbpassword

As with the Horizon View connection it’s best to put this into a variable so it can be used later on. The $hvedbpassword should be the password for the user that View uses to connect to the database server in plain text! Earlier in the script I read the password from hashed contents in a text file.The request has been dropped to be able to pass encrypted credentials and/or creta a credentialstore for this.

Next up is grabbing the events for a certain Desktop

$lastevent=get-hvevent -hvdbserver $eventdb -timeperiod 'day' -messagefilter $problemvm.base.name

This could use some rework since I would prefer the time period to be a variable based on the current date but if the event is older then a day it will be hard to find anything on it anyway.

if ($lastevent.events){
$lasteventtime=$lastevent.events | select -expandproperty eventtime -first 1
$lasteventmessage=$lastevent.events | select -expandproperty message -first 1 
$lasteventusername=$lastevent.events | select -expandproperty Username -first 1 
}

This grabs the latest event, the time it happened and the user it happened to. This can be anything including a logoff. It might be able to help you why a lot of desktops are ending up in a rotten state.

The rest of the script is basic building of arrays, filling them, mailing it etc etc. So still not a lot of complicated code that some people build but it’s a bit of the basics in talking to the View Api and the event database.

This is the output you will get (this is from an html file and heavily edited to anonimize it)

The complete script, please do use and abuse it to your own taste as I have done with the original:

#########################################################################################
#																						#
# Get List of Desktops that are not available or connected		 						#
# This is based on the script posted here:												#
# https://blogs.vmware.com/euc/2017/01/vmware-horizon-7-powercli-6-5.html				#
# Required:																				#
# Powercli 6.5 Release 1																#
# The VMware.Hv.Helper Module from https://github.com/vmware/PowerCLI-Example-Scripts	#
#																						#
#########################################################################################

#region variables
#########################################################################################
#								Variables												#
#	Password files need to be filled firs using:										#
#	Read-Host -AsSecureString | ConvertFrom-SecureString | Out-File 'filename.txt'		#
#	Enter password and press enter														#
#	vCenter things have been marked out but I left them in here 						#
#	because they might be usefull for when someone else uses this script				#
#########################################################################################
$cs = "connectionbroker"														# Horizon Connection Server
$hvcsUser= "Service_Account"													# User account to connect to Connection Server
$hvcsPassword = get-content .\hvcs_Credentials.txt | convertto-securestring		# Password for user to connect to Connection Server
$csDomain = "domain"															# Domain for user to connect to Connection Server
$hvedbpassword=get-content .\hvedb_Credentials.txt | convertto-securestring   	# password to access event database
$mailto="[email protected]"														# Address to send the status mail to
$mailfrom="[email protected]"											# Address to send the mail from
$mailsubject="Overview bad VDI desktops"										# Mail subject
$smtpserver="mailserver.domain.com"												# Mail server			
#$vcuser="vcuser"																# User account to access the vCenter server
#$vcpassword=get-content .\vCenter_Credentials.txt | convertto-securestring		# password to access the vCenter server
#vc = "Enter vCenter name"														# vCenter Server



$baseStates = @('PROVISIONING_ERROR',
                'ERROR',
                'MAINTENANCE',
                'DISCONNECTED',
                'AGENT_UNREACHABLE',
                'AGENT_ERR_STARTUP_IN_PROGRESS',
                'AGENT_ERR_DISABLED',
                'AGENT_ERR_INVALID_IP',
                'AGENT_ERR_NEED_REBOOT',
                'AGENT_ERR_PROTOCOL_FAILURE',
                'AGENT_ERR_DOMAIN_FAILURE',
                'AGENT_CONFIG_ERROR',
                'UNKNOWN')
				

#endregion variables

#region initialize
###################################################################
#                    Initialize                                  #
###################################################################
# --- Import the PowerCLI Modules required ---
Import-Module VMware.VimAutomation.HorizonView
Import-Module VMware.VimAutomation.Core

# --- Connect to Horizon Connection Server API Service ---
$hvServer1 = Connect-HVServer -Server $cs -User $hvcsUser -Password $hvcsPassword -Domain $csDomain

# --- Get Services for interacting with the View API Service ---
$Services1= $hvServer1.ExtensionData

# --- Connect to the vCenter Server ---
#Connect-VIServer -Server $vc -User $vcUser -Password $vcPassword

# --- Connect to the view events database ---
$eventdb=connect-hvevent -dbpassword $hvedbpassword

#endregion initialize

#region html
###################################################################
#                    HTML                                         #
###################################################################

$style = "<style>BODY{font-family: Arial; font-size: 10pt;}"
$style = $style + "TABLE{border: 1px solid black; border-collapse: collapse;}"
$style = $style + "TH{border: 1px solid black; background: #dddddd; padding: 5px; }"
$style = $style + "TD{border: 1px solid black; padding: 5px; }"
$style = $style + "</style>"

#endregion

#region main
###################################################################
#                    Main                                        #
###################################################################
[email protected]()
#Write-Output ""
if ($Services1) 
	{
     foreach ($baseState in $baseStates) 
		{
           # --- Get a list of VMs in this state ---
           $ProblemVMs = Get-HVMachineSummary -State $baseState

           foreach ($ProblemVM in $ProblemVMs) 
		   {
		   			$lastevent=get-hvevent -hvdbserver $eventdb -timeperiod 'day' -messagefilter $problemvm.base.name
			
				if ($lastevent.events){
					$lasteventtime=$lastevent.events | select -expandproperty eventtime -first 1
					$lasteventmessage=$lastevent.events | select -expandproperty message -first 1 
					$lasteventusername=$lastevent.events | select -expandproperty Username -first 1 
					}
				else{
				$lasteventtime="Last event is longer then 1 day ago"
				$lasteventmessage="Not Available"
				}
			$lastmaintenancedate=(Get-HVMachine -machinename $problemvm.base.name)
		   	$item = New-Object PSObject
			$item | Add-Member -type NoteProperty -Name Name -Value $problemvm.base.name 
			$item | Add-Member -type NoteProperty -Name State -Value $problemvm.base.basicstate 
			$item | Add-Member -type NoteProperty -Name Pool -Value $problemvm.namesdata.desktopname
			$item | Add-Member -type NoteProperty -Name Last_event_time -Value $lasteventtime
			$item | Add-Member -type NoteProperty -Name Last_event_user -Value $lasteventusername
			$item | Add-Member -type NoteProperty -Name Last_event_message -Value $lasteventmessage
			$Problemarray+= $item
           }
		}
	
		if ($problemarray)	
			{
			$mailbody=$Problemarray | sort state,name | convertto-html -head $style -property  name,state,Pool,Last_event_time,Last_event_user,Last_event_message | out-string
			send-mailmessage -smtpserver $smtpserver -to $mailto -from $mailfrom -subject $mailsubject -body $mailbody -bodyashtml 
			}
		else
			{
			send-mailmessage -smtpserver $smtpserver -to $mailto -from $mailfrom -subject $mailsubject -body "No problems found in the Horizon View Environment" 
			}

     Write-Output "Disconnect from Connection Server."
     Disconnect-HVServer -Server $cs -confirm:$false
		} 

else 
	{
     Write-Output "Failed to login in to Connection Server."
     
     }
# --- Disconnect from the vCenter Server ---
#Write-Output "Disconnect from vCenter Server."
#Disconnect-VIServer -Server $vc
#endregion main

 

 

Talking PowerCLI against Horizon view (basics)

You know that VMware product that really lacked on the PowerCLI front called Horizon View? Well from PowerCLI 6.5 R1 it finally (try to imagine saying this like The Rock : Finally Powercli has come to Horizon View!) has its own module that you can use to talk to Horizon View and the View API’s.

Offcourse i am not the first to write about it and lots can already be found at the above link to the VMware blog by Graeme Gordon but I did want to share a couple of easy commands with you. I will not bore you with how to set it up because that’s already perfectly explained in Graeme’s post.

First we need to connect, looks like the connect-viserver right?:

connect-hvserver SERVERNAME

you will get a popup box for credentials, I haven’t found an option yet to do something like new-vicredentialstoreitem yet but you can use a hashed password in a text file.

Now for example to retrieve all disconnected desktops

Get-HVMachineSummary -State DISCONNECTED

This can be changed to whatever states are available for desktops.

One of the things Horizon View always lacked was proper reporting for desktop counts i.e. how many desktops are in what state. Lots of people had to use things like scripts that counted them from the adam database (sloooooow) or used tools like the VMware Horizon toolbox 2. To get a count is now really easy with powercli, just repeat the above command and do a count on it.

(Get-HVMachineSummary -State DISCONNECTED).count

For me this was a matter of a second with over 900 desktops available.

Want some information about a single desktop?

get-hvmachinesummary -machinename "machinename" | fl

In short you can find anything you want with the command or by using the View API’s. Since I am not an APi expert myself I would recommend heading over to the API browser and see what you want to use.  In my next post I will dig into the command a bit more by grabbing the script from the VMware blog post and editing it more to my taste.

Can you smellllllll what The Rock is cooking?

Altaro VM backup 7: the restores (part 2)

So a couple of weeks ago I managed to get my homelab backups running with Altaro.  Backups off course are nice but are worthless if you can’t recover them. This is  why this 2nd and last part of mini serie is about restoring the backups. Altaro has several options available: Restore clone, to a different host, File level restore and Exchange Item level restore plus the option to do a sandbox restore or simulation for testing those backups.

Table of Contents

Disk Usage
VM Restore
File level restore
Sandbox and verification
Boot from backup
Reports
Conclusion

Disk usage

Before restoring anything I was curious how much disk space is in use

Not that much, disk E is in use for the domain controller, file server, pfsense and server 2012 template while disk F is in use for the vCenter server, Platform Service controller and windows 7 template.

And this is how Altaro shows everything int he dashboard (can’t find any other reporting option on storage, yes that’s a hint Altaro I want that stuff in the mail!)

A very small growth rate but then I haven’t done a while lot with the homelab in this time. But the compression and dedupe are nice while the cpu doesn’t even spike that much each day.


VM restore

Ok, enough text about disk usage, let’s actually restore something! First up is VM restore.

To start select the datastore where the VM is saved. I would have preferred to select the VM first because at this point I don’t care where it is saved I want it back asap. And yes I can select all datastores but that shouldn’t be needed.

Click next and select the VM to be restored

Here I can select the point in time to restore from, the name of the restored VM (why does the default name contain clone while it’s a restore?), where to restore to and to disabled the NIC or not.

In vCenter you’ll see a new VM created, renamed and snapshotted

Now Altaro will fill it up and after 23 minutes of waiting (on my slow server) I had a fully functional VM that thought it had crashed 😉


File Level restore

File level restore isn’t that different from a VM level restore. I won’t bore you with the screenshots but first select the datastore and vm to restore from. Then select the point in time you want to get something back from. I don’t really get the order in which this is presented either.

Select the disk, partition, folder and eventually file to restore

Select the place to restore it to (why isn’t the original VM an option over here?)

And the file is restored


Sandbox and verification

Sandbox testing the VM’s is rather easy as well. First choose what you actually want to test. At first I’ll try the option to verify folders. For some steps I will only show the image because I am afraid that you’ve already fallen asleep by now.

Very weird but I can’t select any folders to test? My guess is that all folders will be tested, why do you name it verify folders then?

The full Test Restore is exactly the same but it mounts the VM so you can see it booting. To me this sounds exactly like restoring a VM with its NIC disabled. There seems to be no notification of a successful test and I needed to go to the dashboard to see if it succeeded. And there only the result is visible and no logs or anything. Also the option to remove the sandbox VM is missing.

The option to remove the test VM that seems to be missing is available in the Schedule test drills option. First refresh your infrastructure and select the VMware schedule type

Add a new Sandbox restore schedule, again there are 2 major options, file test and full test restore

So for the full test restore you can select after how much time the VM will be deleted. Besides the schedule not a whole lot of options.

After the schedule has been created you need to drag a VM to the schedule. I guess this will test the last version of the VM backup but for me it would be nice to also test two versions earlier or something.


Boot from backup

The storage I use won’t be able to handle this properly but Altaro also has the option to boot a VM directly from the storage it is saved on. First select if you want to do a verification or recovery mode boot. To show the screens I will take the first option.

It has the same screens to select storage,VM and date so I won’t bother you again with those. At the version tab you can again select the host, datastore to restore to and if you want to have the NIC’s disabled or not.


Reports

The reporting doesn’t really contain a whole lot except a list of succeeded or failed tasks. The detail button doesn’t add a whole lot of information either.

The error history shows a bit more information but still not a lot.


Conclusion

Altaro is a reasonable well done product that lack’s a bit in options for the professional in me. Getting it running is easy and for smaller environments (up to 50 VM’s) where there is no dedicated admin it should get the job done. If they make the move to a Linux based appliance that might be better because for these smaller environments every penny and thus license counts. What I do like are the build in options to actually test the backups.

Getting Started with Altaro VM backup 7 (part 1)

One of the perks of being a VMware vExpert is that you now and then get licenses for and a chance to play with new software. Since I needed a backup solution for my lab I remembered a couple of Backup software builders int he list of companies that support the community. From this list I decided to give Altaro a go and requested the vExpert NFR License. Within a day I received the license and it turned out they just released a brand new version of their software: Version 7!

You can go to Altaro’s website to see what’s new in this version.

The mail contained a download link to the software and after a while I had a new (backup) vm rolled out (someone who wants to sponsor a NUC with 32GB RAM for me? ML150G6’s are slooooooow). Installing the software is next next finish so I won’t bore with that. One thing I noticed is no requirement for a database server. Let’s hope my disks are fast enough for what Altaro does.

This post is in no means a deep dive in what Altaro can give you. It’s a step by step guide to set it up and get started with the product. Also I show some features that are present in the console. Except for the NFR license Altaro has had no influence on this post itself.

Getting Started

The first thing you see after the installation is the Welcome screen that let’s you choose to connect to a local or remote server. Just select this machine (I like it that they mention the required port for the remote server though!)

Next up is the Quick Setup screen, select add Hyper-V / VMware Host (duh)

So here you can select between loose ESXi hosts and vCenter, I selected vCenter.

Enter the vCenter’s dns name/ip address and proper credentials (yes I am lazy in my lab) and next (it wil test the connection itself anyway. Under port settings you can set alternate ports if required.

Altaro will now recognize and add the ESXi hosts that are added to the vCenter server. It had no problems with my LABESX01 that is powered down. Hit finish to end this.

You are taken to the hosts screen where they show running on a trial license.

You can hit the 30 days remaining to add licenses, the licensing options will be shown.

The license can be added with the appropriate button. Enter the license key and select assign license.

You need to repeat this for all hosts!

After this I went back to the quick setup screen to add storage. Altaro has several options to write to but I added a couple of cmdk’s to the backup server that run on local slow as **** sata drives on this server.

Select physical disk

Select the disk (yes these screenshots are mixed up), create a new folder if you want and choose select .

When the storage is added you can link vm’s to the storage by drag & drop.

back to the quick setup i went and choose to create the first backup. this will take you to the take backup screen, select the vm to backup and hit take backup.

Schedules

I decided to remove the original schedules and add a new one. The time might look strange but during the daytime no-one is home and I ain’t playing with it unlike in the evening and sometimes nights. After deleting the old ones click Add Backup Schedule

Select the time and days you want to run the backup at.

When the schedule is created drag and drop the vm’s to the schedule to link them. Don’t forget to save these settings at the bottom.

Retention

Setting retentions is fairly easy, by default vm’s are linked to the 2 week retention policy. If you remove them by clicking the X they wil get moved to the Never delete policy! Please be aware that after adding a retention time I wasn’t able to remove it so this might get cluttered easily.

Notifications

Fairly basic stuff in here, you can get notified by email or events int he event log.

Advanced Settings

Not that extremely advanced but under advanced settings you can select deduplication, encryption, iso’s to be backupped and if Change Block tracking needs to be used. The last option is exclude drives where you actually select the vmdk to exclude so make sure what vmdk is what drive or mapping.

VSS Settings

Under VSS Settings you have the option to select application consistent  backups and to truncate logs.

The Master encryption Key

.The name says enough about what this does.

The End of part 1

In this part one we got started using Altaro Vm Backup 7 and viewed some of the options In the management console. In the next part we’re going to see if we can actually restore files, maybe start a vm from backup and see what the sandboxing does.

 

 

 

 

 

 

VMworld 2016 US Part 4 – the last one!

So right now it’s thursday evening and here I am in my hotel room too damn tired to even go outside. VMworld is a wrap and wow it was awesome. Yesterday I had 2 more sessions. First a quick vExpert session at the Docker booth where we got a nice vExpert embroided hat.Then it was time to get the vExpert Raspberry Pi 3 at the Datrium booth. Men they had big issues on getting them in but succeeded at last so thank you very much for that! I ended with a Rubrik session with Chris Wahl that was pretty good. In the evening it was time for the biggest party of them all at the Las Vegas Motor Speedway. To be honest I think the sound of the bands sucked and the music of the dj’s wasn’t good either but I had an awesome time playing all the games, talking to people ad even made a lap in 1 of the 50! Rental cars that wil probably be going back to budget with hardly any tires left.

So today was the last day and I did only 1 session and that was about troubleshooting Horizon and killed the time by doing some labs and hanging at the vBrownbag area where I learned a lot by listening to the sessions. This space just seemed to be vExpert HQ the whole week.

All in all I think this was the best way ever to experience your first VMworld. I really want to thank all vExperts for welcoming me in the community because I don’t think I would have had such an awesome experience without you guys!