Powershell

Restart-MsSqlServer

How to restart MS SQL Server service on Windows using Powershell, by using elevated privileges.

Start-Process -Wait -Verb RunAs `
     -FilePath powershell `
     -ArgumentList @('-Command', 'Restart-Service -Name MSSQLSERVER')

Get-MonthNames


function Set-CurrentCulture([System.Globalization.CultureInfo] $culture) {
    [System.Threading.Thread]::CurrentThread.CurrentUICulture = $culture
    [System.Threading.Thread]::CurrentThread.CurrentCulture = $culture 
}


function Get-MonthNames() {
    $currentCulture  = Get-Culture
    Set-CurrentCulture 'pl-PL'
    Write-Host 'Polski'
    (1..12) | ForEach-Object { Get-Date -Month $_ -Format "MM MMMM" } | Out-Host
    Set-CurrentCulture 'en-US'
    Write-Host 'English'
    (1..12) | ForEach-Object { Get-Date -Month $_ -Format "MM MMMM" } | Out-Host

    Set-CurrentCulture $currentCulture
}