I have Sharepoint 2013 and Powershell deployment.
I execute muy ps1 script in SPS01 machine. Farm servers are SPS01, SPS02, SPS03, SPS04. User for deploy is UserInstallerMoss , it's Farm Administrator and only local Administrator in SPS01, not in others servers.
I call this function:
function RestartTimerFarm
{
Write-Host -f Green Restarting OWSTIMER instances on Farm
$farm = Get-SPFarm
$farm.TimerService.Instances | foreach {$_.Stop();$_.Start();}
}
I get this error when its call to Stop method:
This operation uses the SharePoint Administration service (spadminV4), which could not be contacted. If the service is stopped or disabled, start it and try the operation again.)
Now, I set UserInstallerMoss as local Administrator in SPS01, SPS02, SPS03, SPS04.
I get this error:
This operation uses the SharePoint Administration service (spadminV4), which could not be contacted. If the service is stopped or disabled, start it and try the operation again.)
But if I execute WMI and Get-SPServer cmdlet all is OK
$servers=Get-SPServer | where {$_.role -ne "Invalid" }
foreach ($server in $servers)
{
$serverName = $server.Name
WriteTrace("Server in Farm... " + $serverName)
CheckRemoteServiceStatus -Machine $serverName -Name "SPAdminV4" -Status "Running"
WriteTrace("Restarting SPTimerV4 service in server... " + $serverName)
$result = (Get-WmiObject -computer $serverName Win32_Service -Filter "Name='SPTimerV4'").InvokeMethod("StopService",$null)
Start-Sleep -seconds 2
$result = (Get-WmiObject -computer $serverName Win32_Service -Filter "Name='SPTimerV4'").InvokeMethod("StartService",$null)
WriteTrace("SPTimerV4 service restarted in server " + $serverName)
}