# ===================================================================================
# Reset-LocalServer.ps1
# (c) SharePoint Products ApS, 2010-2026
# ===================================================================================

$myWindowsID=[System.Security.Principal.WindowsIdentity]::GetCurrent()
$myWindowsPrincipal=new-object System.Security.Principal.WindowsPrincipal($myWindowsID)
$adminRole=[System.Security.Principal.WindowsBuiltInRole]::Administrator
if ($myWindowsPrincipal.IsInRole($adminRole))
{
	$Host.UI.RawUI.BackgroundColor = "DarkBlue"
	clear-host
} else
{
    $arguments = $myInvocation.MyCommand.Definition;
    Start-Process powershell.exe -Verb RunAs -ArgumentList "-file `"$arguments`"";
    exit;
}

$Host.UI.RawUI.WindowTitle = "Resetting SharePoint Services on local server"
$0 = $myInvocation.MyCommand.Definition
$dp0 = [System.IO.Path]::GetDirectoryName($0)
. "$dp0\Functions.ps1"

$ServiceNames=@("SPTimerV4","SPAdminV4","IISADMIN","W3SVC", "OSearch15")
Restart-SharePointServicesOnLocalServer $ServiceNames

Pause
