feat: add windows 11 build
This commit is contained in:
30
scripts/windows/windows-init.ps1
Normal file
30
scripts/windows/windows-init.ps1
Normal file
@@ -0,0 +1,30 @@
|
||||
<#
|
||||
.DESCRIPTION
|
||||
Enables Windows Remote Management on Windows builds.
|
||||
#>
|
||||
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
||||
# Set network connections provile to Private mode.
|
||||
Write-Output 'Setting the network connection profiles to Private...'
|
||||
$connectionProfile = Get-NetConnectionProfile
|
||||
While ($connectionProfile.Name -eq 'Identifying...') {
|
||||
Start-Sleep -Seconds 10
|
||||
$connectionProfile = Get-NetConnectionProfile
|
||||
}
|
||||
Set-NetConnectionProfile -Name $connectionProfile.Name -NetworkCategory Private
|
||||
|
||||
# Set the Windows Remote Management configuration.
|
||||
Write-Output 'Setting the Windows Remote Management configuration...'
|
||||
winrm quickconfig -quiet
|
||||
winrm set winrm/config/service '@{AllowUnencrypted="true"}'
|
||||
winrm set winrm/config/service/auth '@{Basic="true"}'
|
||||
|
||||
# Allow Windows Remote Management in the Windows Firewall.
|
||||
Write-Output 'Allowing Windows Remote Management in the Windows Firewall...'
|
||||
netsh advfirewall firewall set rule group="Windows Remote Administration" new enable=yes
|
||||
netsh advfirewall firewall set rule name="Windows Remote Management (HTTP-In)" new enable=yes action=allow
|
||||
|
||||
# Reset the autologon count.
|
||||
# Reference: https://docs.microsoft.com/en-us/windows-hardware/customize/desktop/unattend/microsoft-windows-shell-setup-autologon-logoncount#logoncount-known-issue
|
||||
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon' -Name AutoLogonCount -Value 0
|
||||
Reference in New Issue
Block a user