You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
2.5 KiB

# DISM /Online /Get-TargetEditions
# DISM /Online /Set-Edition:ServerStandard /ProductKey:XXXXX-XXXXX-XXXXX-XXXXX-XXXXX /AcceptEula
Enable-PSRemoting -Force
Set-Service WinRM -StartMode Automatic
# Get-Item WSMan:\localhost\Listener
# Get-Item WSMan:\localhost\Client\TrustedHosts
# & winrm delete winrm/config/Listener?Address=*+Transport=HTTP
# & winrm create winrm/config/Listener?Address=*+Transport=HTTPS@{Hostname="$Env:Computername";CertificateThumbprint=
New-SelfSignedCertificate -DnsName $Env:Computername -CertStoreLocation Cert:\LocalMachine\My
# $cert = Import-PfxCertificate -FilePath C:\Setup\WinRMCert.pfx -CertStoreLocation Cert:\LocalMachine\My -Password (ConvertTo-SecureString -ApPlainText -String 123456 -Force)
$thumbprint = (Get-ChildItem Cert:\LocalMachine\my | where { $_.Subject -eq "CN=" + $Env:Computername }).Thumbprint
New-Item -Path WSMan:\localhost\Listener -Transport HTTPS -Address * -CertificateThumbPrint $thumbprint -Force
New-NetFirewallRule -Displayname "WinRM - Powershell remoting HTTPS-In" -Name "WinRM - Powershell remoting HTTPS-In" -Profile Any -LocalPort 5986 -Protocol TCP
Enable-NetFirewallRule -DisplayName "WinRM - Powershell remoting HTTPS-In"
Enable-NetFirewallRule -DisplayName "Windows Management Instrumentation (DCOM-In)"
Enable-NetFirewallRule -DisplayGroup "Remote Event Log Management"
Enable-NetFirewallRule -DisplayGroup "Remote Service Management"
Enable-NetFirewallRule -DisplayGroup "Remote Scheduled Tasks Management"
Enable-NetFirewallRule -DisplayGroup "Windows Defender Firewall Remote Management"
Enable-WSManCredSSP -Role Server -Force
Set-Item -Path WSMan:\localhost\Service\Auth\CredSSP -Value $true
Restart-Service -Force WinRM
Set-Item WSMan:\localhost\Client\TrustedHosts -Force -Concatenate -Value
Set-Item WSMan:\localhost\Client\TrustedHosts -Force -Concatenate -Value
# Install-WindowsFeature -Name Hyper-V -IncludeManagementTools
Install-WindowsFeature -Name Containers
Install-PackageProvider -Name NuGet -MinimumVersion -Force
Install-Module -Name DockerMsftProvider -Repository PSGallery -Force
# Get-PackageProvider -ListAvailable
# Get-PackageSource -ProviderName DockerMsftProvider
Install-Package -Name Docker -ProviderName DockerMsftProvider -Force
Start-Service Docker
Set-Service Docker -StartMode Automatic
$env:PATH += ";$env:ProgramFiles\docker"
# Set up SSH
# Add-WindowsCapability -Online -Name OpenSSH.Server~~~~
# Start-Service sshd
# Set-Service -Name sshd -StartMode Automatic