olly - Fotolia

Check configuration settings for SCVMM service templates

A misconfigured SCVMM service template can cause serious headaches. Before deploying service templates in production, validate them with SCVMM Manager or PowerShell.

An incorrect deployment of SCVMM service templates could result in errors, but if you validate the configuration before you deploy service templates in a production environment, you can avoid having to reconfigure them. Fortunately, there are multiple ways to validate service templates. For example, you could use SCVMM Manager or PowerShell cmdlets to ensure that your service templates are properly configured. Service templates exist to define the configuration of a service and can deploy a group of VMs together; the VMs in a service template might have the same configuration, or different configurations.

You can create and save service templates in the SCVMM Manager. The SCVMM Manager validates all settings and will issue a warning if it encounters any configuration errors. However, the SCVMM Manager only validates service templates that you are in the process of saving. PowerShell validates service templates you've already saved and displays errors or warnings in a PowerShell window. Use the Test-SCServiceTemplate cmdlet to test the service template configuration in PowerShell with this script:

$ThisTemplate = Get-SVServiceTemplate –Name “Tier3VMsTemplate”
$ErrorsOrWarnings = Test-SCServiceTemplate –ServiceTemplate $ThisTemplate

Note that Test-SCServiceTemplate supports the ValidationErros property, which stores any errors or warnings that the second PowerShell command reports. The [0] index of array stores all errors and warnings.

This PowerShell command only tests one service template at a time. If you want to validate configuration settings across all service templates, use the following script:

$AllVMTemplates = Get-SCServiceTemplate –Name *
ForEach ($Template in $AllVMTemplates)
$ThisTemplate = Get-SVServiceTemplate –Name $Template
$ErrorsOrWarnings = Test-SCServiceTemplate –ServiceTemplate $ThisTemplate
IF { $ErrorsOrWarnings.ValidationErrors.Count –eq 0)
Write-Host “VMM Service Template Error occurred: “ $ThisTemplate

The first PowerShell command collects and stores all service template names in the $AllVMTemplates variable and then ForEach statement loops through all templates and validates them one by one. The IF condition checks to make sure ValidationErrors.Count reports to 0. If it reports greater than 0, PowerShell prints the service template name on-screen with any errors or warnings encountered during the validation.

SCVMM is modular in design, so make sure that your IT staff uses the same SCVMM Manager to validate service templates before they start a deployment.

Next Steps

Back up and export SCVMM service templates

Update VM hosts with SCVMM Maintenance Mode

Learn about changes to Service Center 2016

Dig Deeper on Microsoft Hyper-V management