Инструменты пользователя

Инструменты сайта


Боковая панель

playground:win2012r2

Содержание

Windows 2012 R2

Для работы под libvirtd c virtio:

bcdedit.exe -set loadoptions DISABLE_INTEGRITY_CHECKS
bcdedit.exe -set TESTSIGNING ON

Windows Core

Установка .NET Framework 4.5 (для Windows 2012 R2 не нужно):

PS > Install-WindowsFeature .NET-Framework-45-Features

Быстрый вызов KMSAuto

PS > cd $home
PS > mkdir WindowsPowerShell
PS > echo "New-Alias kmsauto 'C:\ProgramData\KMSAuto\KMSAuto Net.exe' > $profile
PS > echo "New-Alias kmsauto 'C:\ProgramData\KMSAuto\KMSAutoCleaner.exe' > $profile

Разрешить пинги

PS > Set-NetFirewallRule -Name FPS-ICMP4-ERQ-In -Enabled True -Profile Private -Action ALlow

Выключить компьютер

PS > Stop-Computer

Удалить программу

PS > Get-WmiObject -Class Win32_Product | Select-Object -Property Name
PS > $MyApp = Get-WmiObject -Class Win32_Product | Where-Object{$_.Name -eq "Free Tools"}
PS > $MyApp.Uninstall()

При входе на Server Core открывается командная строка (cmd.exe). Чтобы вместо командной строки у вас всегда открывалась консоль PowerShell.exe, нужно внести изменения в реестр. Выполните команды:

Set-ItemProperty -Path
'HKLM:\Software\Microsoft\Windows NT\CurrentVersion\WinLogon'
-Name Shell -Value 'PowerShell.exe'

И перезагрузите сервер:

Restart-Computer -Force

Включить, отключить, проверить статус поддержки IPv6 для сетевого адаптера:

Disable-NetAdapterBinding -Name "Ethernet0" -ComponentID ms_tcpip6
Enable-NetAdapterBinding -Name "Ethernet0" -ComponentID ms_tcpip6
Get-NetAdapterBinding -ComponentID ms_tcpip6

SQL server

To install .NET Framework 3.5 from installation media located on a network share, use the following command:

Install-WindowsFeature Net-Framework-Core -source .\windows2012cd\sxs

Чтобы разрешить удаленные соединения, выполните следующие инструкции для экземпляра Server Core в локальной программе SQLCMD.exe.

EXEC sys.sp_configure N'remote access', N'1'  
GO
RECONFIGURE WITH OVERRIDE
GO

Включите и запустите службу браузера SQL Server browser service

Set-service sqlbrowser -StartupType Auto
Start-service sqlbrowser

Включите поддержку TCP/IP на экземпляре SQL Server

Import-Module SQLPS
$smo = 'Microsoft.SqlServer.Management.Smo.'  
$wmi = new-object ($smo + 'Wmi.ManagedComputer')  
# Enable the TCP protocol on the default instance.  If the instance is named, replace MSSQLSERVER with the instance name in the following line.  
$uri = "ManagedComputer[@Name='" + (get-item env:\computername).Value + "']/ServerInstance[@Name='MSSQLSERVER']/ServerProtocol[@Name='Tcp']"  
$Tcp = $wmi.GetSmoObject($uri)  
$Tcp.IsEnabled = $true  
$Tcp.Alter()  
$Tcp

You can enable the sa login with T-SQL.

ALTER LOGIN sa ENABLE ;  
GO  
ALTER LOGIN sa WITH PASSWORD = '<enterStrongPasswordHere>' ;  
GO

See the following example to open TCP port 1433 and UDP port 1434 for SQL Server default instance, and SQL Server Browser Service:

New-NetFirewallRule -DisplayName "SQLServer default instance" -Direction Inbound -LocalPort 1433 -Protocol TCP -Action Allow
New-NetFirewallRule -DisplayName "SQLServer Browser service" -Direction Inbound -LocalPort 1434 -Protocol UDP -Action Allow

LoginMode values:

  • 1: Windows Authentication
  • 2: SQL Server and Windows Authentication mode
Set-ItemProperty -Path
'HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQLServer'
-Name LoginMode -Value 2 -Type dword
playground/win2012r2.txt · Последние изменения: 2023/02/25 13:30 — vvp