Get-MrVssProvider.ps1

#Requires -Version 3.0
function Get-MrVssProvider {

<#
.SYNOPSIS
    Retrieves a list of the VSS providers that are installed on the specified computer(s).
  
.DESCRIPTION
    Get-MrVssProvider is an advanced function for determining what VSS (Volume Shadow Copy Service) providers are
    currently installed on one or more computers.
  
.PARAMETER ComputerName
    The name of the computer(s) to determine the VSS providers for.
 
.PARAMETER Credential
    Specifies a user account that has permission to perform this action. The default is the current user.
 
    Type a user name, such as User01 or Domain01\User01. Or, enter a PSCredential object, such as one generated by the
    Get-Credential cmdlet. If you type a user name, this cmdlet prompts you for a password.
  
.EXAMPLE
     Get-MrVssProvider -ComputerName Server01, Server02, Server03
 
.EXAMPLE
     Get-MrVssProvider -ComputerName Server01, Server02, Server03 -Credential (Get-Credential)
 
.INPUTS
    None
  
.OUTPUTS
    PSCustomObject
  
.NOTES
    Author: Mike F Robbins
    Website: http://mikefrobbins.com
    Twitter: @mikefrobbins
#>


    [CmdletBinding()]
    param (
        [ValidateNotNullOrEmpty()]      
        [string[]]$ComputerName = $env:COMPUTERNAME,

        [System.Management.Automation.Credential()]$Credential = [System.Management.Automation.PSCredential]::Empty
    )

    $Params = @{
        ComputerName = $ComputerName
        ScriptBlock = {Get-ChildItem -Path 'HKLM:\SYSTEM\CurrentControlSet\Services\VSS\Providers' |
                       Get-ItemProperty -Name '(default)'}
        ErrorAction = 'SilentlyContinue'
        ErrorVariable = 'Problem'
    }

    if ($PSBoundParameters.Credential) {
        $Params.Credential = $Credential
    }

    Invoke-Command @Params |
    Select-Object -Property PSComputerName, @{label='VSSProviderName';expression={$_.'(default)'}}

    foreach ($p in $Problem) {
        if ($p.origininfo.pscomputername) {
            Write-Warning -Message "Unable to read registry key on $($p.origininfo.pscomputername)" 
        }
        elseif ($p.targetobject) {
            Write-Warning -Message "Unable to connect to $($p.targetobject)"
        }
    }

}