Category: VMware vSphere 6.0

Microsoft Windows PowerShell – Get Host Architecture

You may use the following Microsoft Windows PowerShell script below to get the architecture, physical or virtual, of a Windows host on a network.

<#
.SYNOPSIS
This script will provide the architure (physical of virtual) of a host.
.DESCRIPTION
This script will provide the architure (physical of virtual) of a host.
.EXAMPLE
systeminfo /s $HOSTNAME | findstr /c:”Model:” /c:”Host Name”
.AUTHOR
Written by Noel Enrique Alvarez on Tuesday, April 23, 2019.
#>

#Requst the hostname of the host
$HOSTNAME = Read-Host “What is the hostname of the server?”

#Provide the architure of the host
systeminfo /s $HOSTNAME | findstr /c:”Model:” /c:”Host Name”


VMware PowerCLI – Power On a Virtual Machine

You may use the VMware PowerCLI cmdlet below to power on a VMware virtual machine.

Start-VM -VM SERVER


VMware PowerCLI – Create a Snapshot

You may use the following VMware PowerCLI cmdlet to create a snapshot of a virtual machine (VM) in VMware.

New-Snapshot -VM HOSTNAME -Name “<<>>” -Description “<<>>”


VMware PowerCLI – Exit VMware ESXi Host out of Maintenance Mode

You may use the following VMware PowerCLI script to exit a VMware ESXi host out of maintenance mode.

<# .SYNOPSIS This script will exit a VMware ESXi host out of maintenance mode. .DESCRIPTION This script will exit a VMware ESXi host out of maintenance mode. .EXAMPLE Set-VMHost -VMhost HOST.DOMAIN.COM -State Connected. .AUTHOR Written by Noel Enrique Alvarez on Monday, April 15, 2019. #>

#Request the hostname of the VMware ESXi host
$HOSTNAME = Read-Host “What is the hostname of the VMware ESXi host?”

#Exit the VMware ESXi host out of maintenance mode
Set-VMHost -VMhost $HOSTNAME -State Connected

#End of script


VMware PowerCLI – Place VMware ESXi Host in Maintenance Mode

You may use the following VMware PowerCLI script to place a VMware ESXi host in maintenance mode.

<# .SYNOPSIS This script will place a VMware ESXi host in maintenance mode. .DESCRIPTION This script will place a VMware ESXi host in maintenance mode. .EXAMPLE Set-VMHost -VMhost HOST.DOMAIN.COM -State Maintenance. .AUTHOR Written by Noel Enrique Alvarez on Monday, April 15, 2019. #>

#Request the hostname of the VMware ESXi host
$HOSTNAME = Read-Host “What is the hostname of the VMware ESXi host?”

#Place the VMware ESXi host in maintenance mode
Set-VMHost -VMhost $HOSTNAME -State Maintenance

#End of script


VMware PowerCLI – View Snapshots

You may use the following VMware PowerCLI cmdlets to view all of the snapshots managed by vCenter Server or more specifically a cluster. These are sample commands and further information and documentation may be found here.

Get-VM | Get-Snapshot | Format-List
Get-VM | Get-Snapshot | Format-List VM, Name, SizeGB, Created, Description
Get-VM -Location “CLUSTER01” | Get-Snapshot | Format-List
Get-VM -Location “CLUSTER01”| Get-Snapshot | Format-List VM, Name, SizeGB, Created, Description


VMware vCenter Server 6.0 – Verify the Status of Critical Services Locally

The script below will query the status of the service(s) specified in “C:\Scripts\VMware vCenter Server\Verify_Critical_Services.txt” on the local server. The output of the script will provide the name and status of the service(s) in a formatted list for your viewing. Additionally, it is recommended that the following services be queried as they are critical to the proper functioning of VMware vCenter Server 6.

  • VMware VirtualCenter Server (vpxd)
  • VMware Inventory Service (invsvc)
  • VMware vSphere Web Client (vspherewebclientsvc)

<#
.SYNOPSIS
This script will provide the name and status of the service(s) defined in “C:\Scripts\VMware vCenter Server\Verify_Critical_Services.txt”
.DESCRIPTION
This script will automate the process of providing the status of critical VMware vCenter Server 6 service(s) on the local server
.EXAMPLE
N/A.
.AUTHOR
Written by Noel Enrique Alvarez on Wednesday, November 22, 2017.
#>

#Define the service(s) to query
$Services = Get-Content “C:\Scripts\VMware vCenter Server\Verify_Critical_Services.txt”

#Query the status of the service(s) in “C:\Scripts\VMware vCenter Server\Verify_Critical_Services.txt”
ForEach ($Service in $Services)
{Get-Service $Service |
Format-List -Property Name, Status}


VMware vSphere 6 – Create a Template

VMware includes a great solution, templates, for consistent virtual machine deployments. A template is essentially a master image of a virtual machine that typically includes a guest operating system and applications. Using templates allows you to deploy virtual machines with a consistent configuration. Additionally, below is a step list of steps for creating a template.

  • Install the Microsoft Windows 2012 R2 operating system
  • Install VMware Tools
  • Install Windows Updates
  • Run sysprep (C:\Windows\System32\Sysprep\sysprep.exe)
    • System Cleanup Action: Enter System Out-of-Box Experience (OOBE)
    • Generalize
    • Shutdown Options: Shutdown
  • Right click the virtual machine and select Convert to Template….

 


VMware vSphere Update Manager 6.0 – Attaching a Baseline to a VMware ESXi Host

The following is a step by step guide for attaching a vSphere Update Manager 6.0 baseline to a VMware ESXi 6.0 host.

  1. On the VMware vSphere Web Client home page select Hosts and Clusters.01
  2. On the inventory tree select the VMware ESXi 6.0 host you would like to attach the baseline to.02
  3. On the content area of the VMware vSphere Web Client select the Monitor tab then select Update Manager.03
  4. On the content area of the Update Manager section click Attach….
  5. On the Attach Baseline or Group dialog box select the Individual Baseline or Baseline Groups of your choice then click OK.05
  6. On the content area of the Update Manager verify the baseline is listed under the Attached Baselines: list.06

VMware vSphere Update Manager 6.0 – Create a Dynamic Baseline

The following is a step by step guide for creating VMware vSphere Update Manager 6.0 dynamic baseline. A dynamic baseline is updated dynamically and may be used to verify that your vSphere infrastructure is up to date or out or date, regarding patches.

  1. On the vSphere Client home page under Solutions and Applications click Update Manager.01
  2. On the Update Manager Administration page click the Baseline and Groups tab and View Baselines for: Hosts.02
  3. On the Baselines section click Create….
  4. On the Baseline Name and Type dialog box enter a name for the baseline and select the check box for Host Patch, then click Next >.04
  5. On the Patch Options dialog box select Dynamic and click Next >.05
  6. On the Criteria dialog box select the criteria and click Next >.06
  7. On the Patches to Exclude dialog box select any patches to exclude and click Next >.07
  8. On the Additional Patches dialog box select any patches that did not meet the criteria of step (6) but you would like to include and click Next >.08
  9. On the Ready to Complete dialog box click Finish.09
  10. On the Baselines and Groups tab verify the baseline has been created.10