Resolve VSS errors without rebooting your server

Resolve VSS errors without rebooting your server

Usually when you have a VSS error you will need to reboot your server or open the services.msc console and restart the service that is associated with it. I know I have had to do this a number of times with Exchange services on Small Business Servers to resolve backup issues.

This is a task that can be automated with this PowerShell script.

What the script does is it checks the status of each VSS Writer(which can be manually done in the command prompt by using the command “VSSAdmin list writers“) and then restart the service that is associated with it.

You can also set this to run as a scheduled task maybe in the middle of the night or once a backup has finished.

$ServiceArray = @{
'ASR Writer' = 'VSS';
'Bits Writer' = 'BITS';
'Certificate Authority' = 'EventSystem';
'COM+ REGDB Writer' = 'VSS';
'DFS Replication service writer' = 'DFSR';
'Dhcp Jet Writer' = 'DHCPServer';
'FRS Writer' = 'NtFrs'
'IIS Config Writer' = 'AppHostSvc';
'IIS Metabase Writer' = 'IISADMIN';
'Microsoft Exchange Writer' = 'MSExchangeIS';
'Microsoft Hyper-V VSS Writer' = 'vmms';
'MS Search Service Writer' = 'EventSystem';
'NPS VSS Writer' = 'EventSystem';
'NTDS' = 'EventSystem';
'OSearch VSS Writer' = 'OSearch';
'OSearch14 VSS Writer' = 'OSearch14';
'Registry Writer' = 'VSS';
'Shadow Copy Optimization Writer' = 'VSS';
'Sharepoint Services Writer' = 'SPWriter';
'SPSearch VSS Writer' = 'SPSearch';
'SPSearch4 VSS Writer' = 'SPSearch4';
'SqlServerWriter' = 'SQLWriter';
'System Writer' = 'CryptSvc';
'WMI Writer' = 'Winmgmt';
'TermServLicensing' = 'TermServLicensing';
}
vssadmin list writers | Select-String -Context 0,4 'writer name:' | ? {$_.Context.PostContext[3].Trim() -ne "last error: no error"} | Select Line | %
{$_.Line.tostring().Split("'")[1]}| ForEach-Object {Restart-Service $ServiceArray.Item($_) -Force}

Replies: 4 / Share:

You might also like …

4 thoughts on “Resolve VSS errors without rebooting your server

  • When run it generates a prompt and then errors

    Restart-Service : Cannot bind argument to parameter ‘Name’ because it is null.
    At C:\Users\thinkit\Desktop\restart-vss.ps1:57 char:68
    + {$_.Line.tostring().Split(“‘”)[1]}| ForEach-Object {Restart-Service <<<< $ServiceArray.Item($_) -Fo
    rce}
    + CategoryInfo : InvalidData: (:) [Restart-Service], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Com
    mands.RestartServiceCommand

    Reply

Post Comment

Your email address will not be published. Required fields are marked *