Search This Blog

Wednesday, November 30, 2011

Start "Sharepoint 2010 Administration" Service using Powershell Script

Many a time we are into a situation that we have to deploy the WSP file by using Powershell script and it is required that if you want to deploy a wsp file in Sharepoint than "Sharepoint 2010 Administration" service has to be in Started status.

So if you want to start the "Sharepoint 2010 Administration" Service also through Powershell script than below is the snippet of Powershell script by using which we can start it before deploying the WSP.

Create a text file in notepad and add the below mentioned Script line and save this file as StartAdminService.ps1.

$AdminServiceName = "SPAdminV4"
$snapin="Microsoft.SharePoint.PowerShell"

if (get-pssnapin $snapin -ea "silentlycontinue")
{
    write-host -f Green "PSsnapin $snapin is loaded"
}
if ($(Get-Service $AdminServiceName).Status -eq "Stopped")
{
    $IsAdminServiceWasRunning = $false;
    Start-Service $AdminServiceName
    write-host -f Green "SPAdminV4 Service has been started Successfully."

}
else
{
    write-host -f Green "SPAdminV4 Service is already started."
}

Now drag and drop the text file in the Sharepoint 2010 Management Shell and Press Enter key. It will start the "Sharepoint 2010 Administration" service if it is not started.

Hope it will be a help to you.

Cheers!
Ravish

No comments:

Post a Comment