PowerShell Function to Determine the Installed VSS Providers

I've been migrating one of my customers from some older EqualLogic storage area networks to a Nimble SAN. It has all been good with the exception of some problems with VSS (Volume Shadow Copy Service). They use Altaro for backups and from what I've found, Nimble and Altaro don't play well together when it comes to VSS. Nimble's software was installed on the Hyper-V hosts and all three vendors (Nimble, EqualLogic, and Altaro) VSS providers seemed to play well together until volumes were actually moved to the Nimble SAN. The backup for each and every VM failed consistently once they were onto the Nimble SAN.

Once the Nimble VSS provider was removed from the Hyper-V hosts, all was well again with the Altaro backups. With all of this drama about VSS problems, I was surprised to find that there aren't any PowerShell cmdlets for working with VSS so I decided to write a function that could at least be used to determine what VSS providers exist on a computer without having to dig around in the registry manually.

 1#Requires -Version 3.0
 2function Get-MrVssProvider {
 3
 4<#
 5.SYNOPSIS
 6    Retrieves a list of the VSS providers that are installed on the specified computer(s).
 7
 8.DESCRIPTION
 9    Get-MrVssProvider is an advanced function for determining what VSS (Volume Shadow Copy Service) providers are
10    currently installed on one or more computers.
11
12.PARAMETER ComputerName
13    The name of the computer(s) to determine the VSS providers for.
14
15.PARAMETER Credential
16    Specifies a user account that has permission to perform this action. The default is the current user.
17
18    Type a user name, such as User01 or Domain01\User01. Or, enter a PSCredential object, such as one generated by the
19    Get-Credential cmdlet. If you type a user name, this cmdlet prompts you for a password.
20
21.EXAMPLE
22     Get-MrVssProvider -ComputerName Server01, Server02, Server03
23
24.EXAMPLE
25     Get-MrVssProvider -ComputerName Server01, Server02, Server03 -Credential (Get-Credential)
26
27.INPUTS
28    None
29
30.OUTPUTS
31    PSCustomObject
32
33.NOTES
34    Author:  Mike F Robbins
35    Website: http://mikefrobbins.com
36    Twitter: @mikefrobbins
37#>
38
39    [CmdletBinding()]
40    param (
41        [ValidateNotNullOrEmpty()]
42        [string[]]$ComputerName = $env:COMPUTERNAME,
43
44        [System.Management.Automation.Credential()]$Credential = [System.Management.Automation.PSCredential]::Empty
45    )
46
47    $Params = @{
48        ComputerName = $ComputerName
49        ScriptBlock = {Get-ChildItem -Path 'HKLM:\SYSTEM\CurrentControlSet\Services\VSS\Providers' |
50                       Get-ItemProperty -Name '(default)'}
51        ErrorAction = 'SilentlyContinue'
52        ErrorVariable = 'Problem'
53    }
54
55    if ($PSBoundParameters.Credential) {
56        $Params.Credential = $Credential
57    }
58
59    Invoke-Command @Params |
60    Select-Object -Property PSComputerName, @{label='VSSProviderName';expression={$_.'(default)'}}
61
62    foreach ($p in $Problem) {
63        if ($p.origininfo.pscomputername) {
64            Write-Warning -Message "Unable to read registry key on $($p.origininfo.pscomputername)"
65        }
66        elseif ($p.targetobject) {
67            Write-Warning -Message "Unable to connect to $($p.targetobject)"
68        }
69    }
70
71}

Simply call the function, specify the server names, and credentials. If credentials aren't specified, the currently logged on users credentials are used.

1Get-MrVssProvider -ComputerName dc01, doesnotexist, sql02

vss-provider1a.jpg

PowerShell remoting does need to be enabled on the targeted systems, but that shouldn't be a problem for most since PowerShell remoting is enabled by default on Windows Server 2012 and higher and it can be enabled on others with the Enable-PSRemoting cmdlet as long as PowerShell version 2.0 or higher is installed.

The Get-MrVssProvider function shown in this blog article can be downloaded from my PowerShell repository on GitHub.

µ