没有GUI,只有shell,登录也是在shell里完成。但可以运行exe GUI,但不是所有都支持,比如Notepad3不支持。注意:不能输入中文,只有英文;很多WIN工具不可用,比如:mmc.exe(*.msc),防火墙默认启用且使用shell来管理,但notepad、regedit可以使用。
实际上官方已经没有Core的叫法了,对于有图形桌面的叫桌面体验,见下图。官方介绍:服务器核心简介 | Microsoft Learn。

vmtools安装完成后:硬盘占用6.6G 内存占用1.2G,和Rocky 9.5还是有差距3.3G/400M。
安装与基本配置
安装过程很简单,在安装完成次启动,要求改Administrator密码,再自动进入SCconfig工具,启用远程桌面后,就可以退出到命令行了。
sconfig 官方文档(输入提示词,看这里;或直接CV大法)
# 禁止开机自启动SConifg
Set-SConfig -AutoLaunch $False
# 查看PowerShell版本:(默认是5.1)
$PSVersionTable.PSVersion
基本配置
Rename-LocalUser -Name "Administrator" -NewName "vmUser"
Rename-Computer -NewName "vmHost" -Restart
- 屏幕分辨率查看:Get-DisplayResolution
- 屏幕分辨率设置:Set-DisplayResolution -Width 1280 -Height 800
- 重启与关机:shutdown -r/s /t 0
- 注销:logoff
- 查找文件(dir是别名):Get-ChildItem -Path C:\ -Filter *.txt -Recurse
dir -path C:\Windows -filter SCregEdit.wsf -R
- SCregEdit.wsf 是 Server Core 特有的脚本,其中的 cli 开关非常有用,它可以把所有常见的配置 Server Core 的命令全部列出,而不需要管理员自己摸索。
cscript C:\Windows\System32\SCregEdit.wsf /cli
网卡配置
sconfig里的配置网卡很蛋痛,使用PowerShell配置(相关参数官方文档)
# 查看网卡配置
Get-NetAdapter|ft -AutoSize
$NAId = Read-Host "Please enter the value of ifIndex"
Get-NetIPAddress -InterfaceIndex $NAId -AddressFamily IPv4 | ft -AutoSize
ipconfig /all
# 配置静态IP,同时自动禁用DHCP获取;掩码=255.255.255.0(-PrefixLength 24)
$NAip="172.17.96.30"; $NApl=20; $NAdg="172.17.96.1"
New-NetIPAddress -InterfaceIndex $NAId -AddressFamily IPv4 -IPAddress $NAip -PrefixLength $NApl -DefaultGateway $NAdg
Set-DnsClientServerAddress -InterfaceIndex $NAId -ServerAddresses $NAdg
# 如有多个DNS,为 Set-DnsClientServerAddress -InterfaceIndex $NAId -ServerAddresses ("10.0.0.1","10.0.0.2")
# 恢复为DHCP自动获取IP信息
Remove-NetIPAddress -InterfaceIndex $NAId
Remove-NetRoute -InterfaceIndex $NAId
Set-NetIPInterface -InterfaceIndex $NAId -Dhcp Enabled
Set-DnsClientServerAddress -InterfaceIndex $NAId -ResetServerAddresses
# 测试网络
ping www.baidu.com
文件只能通过sftp/scp传
- 不能WEB下载:wget/curl 用不了,是Invoke-WebRequest别名;
- Core版本上没有 winget,需要手工安装 https://github.com/microsoft/winget-cli/releases,有200M+,不值得。
- 远程桌面的附加驱动器功能,需要先安装7-zip,后在7zFM.exe,依次从【网络–Microsoft Terminal Services–tsclient】中看到。
安装基本软件 7-zip microsoft.edit WizTree后,使用notepad 创建 .\7z.ps1 文件,内容如下:
start "C:\Program Files\7-Zip\7zFM.exe"
组件WinSxS清理:Dism.exe /Cleanup-Image
或者使用GUI工具:Dism++
# 分析
Dism.exe /online /Cleanup-Image /AnalyzeComponentStore
# 执行标准清理
Dism.exe /online /Cleanup-Image /StartComponentCleanup
# 重置被取代组件的基础(将无法卸载已安装的 Windows 更新)
Dism.exe /online /Cleanup-Image /StartComponentCleanup /ResetBase
Win激活,临时禁用Windows Defender
禁用实时保护:Add-MpPreference (Defender) | Microsoft Learn、How to Disable Windows Defender Using PowerShell?
Set-MpPreference -DisableRealtimeMonitoring $true
- 排除目录:Add-MpPreference -ExclusionPath ‘C:\Temp’
- 把文件复制到C:\Temp,运行激活程序,完成后恢复Windows Defender
- 启用实时保护 Set-MpPreference -DisableRealtimeMonitoring $false
OpenSSH.Server组件配置
查看安装状态:适用于 Windows 的 OpenSSH 入门 | Microsoft Learn
Get-WindowsCapability -Online | Where-Object Name -like 'OpenSSH*'
没有安装可以安装(2025是默认安装但没有启用。之前是默认不安装。):
Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0
启用sshd
手工启动/开机自动启动:
# 启动,或 net start/stop sshd
Start-Service sshd
# 开机自启动
Set-Service -Name sshd -StartupType 'Automatic'
验证:
# 查看状态
Get-Service -Name sshd
# 验证端口 22 是否已打开
netstat -ano | findstr /c:":22"
sshd入站防火墙规则:
# 创建规则
New-NetFirewallRule -Name "OpenSSH-Server-In-TCP" -DisplayName "OpenSSH Server (TCP)" -Protocol TCP -Action Allow -Direction Inbound -LocalPort 22
操作完成后,可使用ssh客户端,使用密码连接上了。
配置sshd默认shell
适用于 Windows 的 OpenSSH Server 配置 | Microsoft Learn
- sshd的配置文件:notepad C:\ProgramData\ssh\sshd_config
- 使用 AllowGroups、 AllowUsers、 DenyGroups 和 DenyUsers 指令控制哪些用户和组可以连接到服务器。 允许/拒绝指令按以下顺序进行处理:DenyUsers、AllowUsers、DenyGroups,最后是AllowGroups。 所有帐户名称都必须以小写形式指定。
- ssh中默认使用 powershell:
New-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShell -Value "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -PropertyType String -Force
配置密钥登录
OpenSSH for Windows 中基于密钥的身份验证 | Microsoft Learn、一台云服务器Windows篇:04、OpenSSH-WIN64 – 未名
- 在服务器端准备administrators_authorized_keys文件
New-Item -Type File -Path C:\ProgramData\ssh\administrators_authorized_keys
get-acl C:\ProgramData\ssh\ssh_host_rsa_key | set-acl C:\ProgramData\ssh\administrators_authorized_keys
或
icacls.exe "C:\ProgramData\ssh\administrators_authorized_keys" /inheritance:r /grant "Administrators:F" /grant "SYSTEM:F"
- 在服务器端启用ssh-agent
Get-Service ssh-agent | Set-Service -StartupType Automatic
Start-Service ssh-agent
Get-Service ssh-agent
- 在客户端生成公钥与私钥
- ssh-keygen 三次回车,就生成公钥与私钥
- 需要将公钥上传到服务器端的administrators_authorized_keys,比如远程桌面中CV大法。notepad C:\ProgramData\ssh\administrators_authorized_keys
- 在服务器端禁用密码,改为私钥登陆
- notepad C:\ProgramData\ssh\sshd_config
#PasswordAuthentication yes
改为
PasswordAuthentication no
- 在服务器端重启 sshd 与 ssh-agent 系统服务生效:
Restart-Service sshd; Restart-Service ssh-agent
Windows Server 中的 Server Core 应用兼容性按需功能 | Microsoft Learn
应用兼容性 FOD提供的工具,有二个价值:提高兼容性与增强故障分析。
Add-WindowsCapability -Online -Name ServerCore.AppCompatibility~~~~0.0.1.0
安装完成后,vm快照增加8G空间,还是找台客户端PC,使用管理工具,远程管理连接吧。
安装后可以使用mmc.exe、explorer.exe,可用msc列表:

PowerShell 使用
查看PowerShell版本:$PSVersionTable.PSVersion
PowerShell 管理Windows防火墙,官方文档:NetSecurity Module | Microsoft Learn
# 启用/禁用
Set-NetFirewallProfile -Profile Domain,Public,Private -Enabled True/False
防火墙规则命令
详细命令帮助:Get-Help xxx -Examples,如果以前没有运行过Update-Help,需要使用 Update-Help 下载帮助文件并将其安装在计算机上。
- 创建:New-NetFirewallRule
- 修改:Set-NetFirewallRule -DisplayGroup “Remote Desktop” -Enabled True|False
- 删除:Remove-NetFirewallRule -DisplayName “xxx”
- 查看:Get-NetFirewallRule
防火墙规则查看与启用/禁用
以远程桌面为例,在powershell中启用/禁用。
Get-NetFirewallRule | Select DisplayName |Select-String "远程桌面"
Get-NetFirewallRule -DisplayName "远程桌面 - 用户模式(UDP-In)"
Get-NetFirewallRule -DisplayName "远程桌面 - 用户模式(TCP-In)" | Select name,DisplayName,Enabled
Set-NetFirewallRule -DisplayName "远程桌面 - 用户模式(TCP-In)" -Enabled True
Set-NetFirewallRule -DisplayName "远程桌面 - 用户模式(UDP-In)" -Enabled True
Set-NetFirewallRule -DisplayName "远程桌面 - 用户模式(TCP-In)" -Enabled False
Set-NetFirewallRule -DisplayName "远程桌面 - 用户模式(UDP-In)" -Enabled False
发表回复