Got a service call yesterday that the backup hasn't been done for three months. Looking at the task scheduler history, there where no errors. So I run the PowerShell script myself, and got an exeption that PSSnapin hasn't been loaded. I added the familiar PSSnapin line, but still got the same exception.

We decided to restart the server, and after that the script ran fine agen without errors. But having to restart the server seems wrong. Is there a service on the server i can restart instead? If so, what's the name of that service?

The Script

Backup-SPFarm -Directory E:\Backup -BackupMethod full

The Problem (edited)

The problem that I face is that the Microsoft.SharePoint.Powershell didn't load at all. And that's the real problem. No matter which checks I did or continue silently (as suggested by Falak). It did not load. My thought is that there is a service that handles the .NET SharePoint.dll - which where inaccessible. I want to restart that service without restarting the server - if possible. Is there a service that controls PSSnapin Microsoft.SharePoint.Powershell?

  • Sounds weird. You're talking about "the PowerShell script" - maybe you want to share parts of it? When you always create a new PS session and initialize the SharePoint Snapin in that session, you should be fine. Maybe you're keeping the session open for too long or something like that?
    – Dennis G
    Commented Feb 9, 2013 at 13:26
  • Not really, I've added the script - but there's nothing special to it.
    – Benny Skogberg
    Commented Feb 9, 2013 at 13:41

1 Answer 1


Create a new task (see the image below). Since we are going to run the script using the standard Windows PowerShell console application so make sure that snap-in is already loaded.

$snapin = Get-PSSnapin | Where-Object {$_.Name -eq 'Microsoft.SharePoint.Powershell'} 
if ($snapin -eq $null) 
    Write-Host "Loading SharePoint Powershell Snapin"    
    Add-PSSnapin "Microsoft.SharePoint.Powershell"  -EA SilentlyContinue
Backup-SPFarm -Directory E:\Backup -BackupMethod full

enter image description here

Update and try to register the SharePoint PowerShell dll manually

Open PowerShell cmd using admin and Go to: C:\Windows\Microsoft.NET\Framework64\v2.0.50727 and run the following command:

.\InstallUtil.exe /LogToConsole=true C:\Windows\assembly\GAC_MSIL\Microsoft.SharePoint.PowerShell\\Microsoft.SharePoint.Powershell.dll

You should be able to get the

The Commit phase completed successfully.

The transacted install has completed.

Happy SharePointing!

  • 1
    Great, now let's delete the comments now! Commented Feb 11, 2013 at 15:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.