Why do we often get it wrong?
Today I want to write about a simple pair of functions I wrote a while ago in response to an occasional issue with our backups. However, the most common issue we have run into seems to be due to a VSS writer timeout within the guest OS; one or two VMs would fail to be backed up during a given session and an inspection of the VSS writers would show one or more writers in a failed state, usually due to timeout.
The frustrating thing about resetting VSS writers is that there are two options — identifying the service associated with that writer and restarting it, or rebooting the server. I was pleased to find this article detailing the relationship between VSS writers and services, because it was this article that gave me the information I needed to automate the repair process well, as much as possible.
The end result uses two functions; both are fairly straightforward but the first, Check-VSSWriters is quite lengthy so I have split it into chunks to make it easier to explain.
Write-Host "The following services have been identified as requiring a restart: Where one or more services require a restart,the list of affected services is written to the screen, and a while-loop is set up around a user input prompt.
The while loop is used to ensure valid input, and a Read-Host prompt is combined with a switch to request and parse user input to determine whether to restart services or not. If the user opts to proceed, a for-loop is invoked and attempts to force a restart for each affected service.
Each service restart attempt is wrapped in a try-catch block to ensure that the result of the restart can be accurately displayed.
If the user opts not to proceed, a message is displayed confirming this. My chief motivation for this was a desire to not have to keep copying script files between systems. PowerShell minimalists will note that this function could be reduced to a one-liner in which a Get-Credential prompt is piped to New-PsSession, which in turn is piped to an Invoke-Command statement.
Being that I work as part of a team, and I have more experience with Powershell than most of my colleagues, I consider the minimalist approach counter-productive and prefer the lengthier, more legible approach as it is more easily understood by someone reviewing the script for the first time.
Braver souls than I might also automate the service restart process, but that is…riskier than I am comfortable with.
Parametrisation allows for a remote target to be specified, as well as an existing credential token. If a remote target is specified, a single ping is sent to that target to verify that it exists and is online; the output of this is piped to Out-Null as the detailed response is not required.
If a response is received, the machine is online; otherwise it is not.
Note that if a remote target is not specified, Check-VSSWriters is then executed on the local system. If a credential token has not been specified for the remote system, a Get-Credential prompt is displayed requesting credentials for the target system.
Invoke-Command is then used with this session. If one or both booleans are not set to false, a message is written to the console. The remote session and command invocation are both performed within a try-catch block so that errors can be adequately identified.
In practical terms, I have normally opened a new console window when using these functions and then closed it; however, good practice is to clean up behind yourself so I will be adding this to my production copy of the above functions shortly.Microsoft SharePoint Foundation Service Pack 1 (SP1) was recently released through Microsoft Update.
On a default installation, Windows SBS Standard administrators should be able to see it in the SBS Console and would need to approve it for installation before it is offered for installation on the server.
The events are typically generated by the following services: System Writer (Cryptographic) service, NPS VSS Writer service, TS Gateway Writer service and (Windows) SP Search VSS Writer service. Sep 09, · SharePoint manages the spsearch and spwebapp accounts and the Windows SBS Manager service manages the spfarm account.
All of these accounts can be found under MyBusiness > Users > SBS Users. Display Name. If any of the writers reports as anything other than ' Stable', you need to restart the VSS service.
The list below shows which service you need to restart based on which VSS writer has failed. VSS Writer. Find each of the VSS writers in a failed state by issuing this command in an elevated command prompt - vssadmin list writers. Make a list of all the failed VSS writers or take a screenshot.
Find the VSS writer’s associated Service Display Name in the table below and restart the service. Volume Shadow Copy Service (VSS) is a software service introduced by Microsoft in Windows Server Data VSS writer support in Data Protector x Volume Shadow Copy Service integration Writer name Writer GUID Backup with hardware SPSearch VSS Writer 5 57af97eaace-ad11e8fc7 No.