Windows Sever Core安装及常用命令

发布于:2025-06-26 ⋅ 阅读:(15) ⋅ 点赞:(0)

一、Windows Sever Core

在安装 Windows Server 的过程中,可以选择“Server Core”(核心安装)这种没有图形用户界面(GUI)的安装方式。这种模式下,Windows Server 主要通过命令行或远程管理进行配置和维护,类似于 Linux 的终端操作方式。

一些关键点说明:

Server Core 的特点:
  • 没有传统的 Windows 桌面环境(没有“开始菜单”、任务栏等)。

  • 只提供基本的命令行界面(默认是 PowerShell 或 CMD)。

  • 占用资源更少,攻击面更小,安全性和性能更好。

  • 推荐用于生产环境中的域控制器、文件服务器、Hyper-V 主机等角色。

可以用哪些方式进行管理?

1.本地命令行管理:

  • 使用 PowerShell 是最主要的方式。

  • 也可以使用 sconfig 工具进行基本配置(比如设置网络、激活 Windows、加入域等)。

2.远程管理:

  • 可以通过另一台带 GUI 的 Windows 服务器使用 “Server Manager” 工具进行远程管理。

  • 也可以使用 Windows Admin Center(WAC) 进行图形化管理。

  • 支持 远程 PowerShell远程桌面(如果配置开启)

3.兼容性:

  • 大多数 Windows Server 功能都可以通过 PowerShell 管理,尤其是新的 Windows Server 版本对 PowerShell 的支持非常完善。

示例命令:

比如在 Server Core 上配置 IP 地址可以用 PowerShell:

New-NetIPAddress -InterfaceAlias "Ethernet" -IPAddress 192.168.1.100 -PrefixLength 24 -DefaultGateway 192.168.1.1

或者使用 sconfig 命令打开配置界面:

sconfig

如果你习惯于 Linux 的 CLI 管理方式,Server Core 实际上提供了一种“Windows 风格的类 Linux CLI 管理体验”。

二、Windows Server Core 常用命令与配置手册

1、启动配置工具:sconfig

sconfig
sconfig 主要功能:
  1. 配置计算机名

  2. 加入域或工作组

  3. 启用远程桌面

  4. 配置 Windows 更新

  5. 设置 IP 地址

  6. 激活 Windows

  7. 退出重启/关机

2、网络配置(使用 PowerShell)

查看网络接口信息:
Get-NetAdapter
设置静态 IP:
New-NetIPAddress -InterfaceAlias "Ethernet" -IPAddress 192.168.1.100 -PrefixLength 24 -DefaultGateway 192.168.1.1
设置 DNS 服务器:
Set-DnsClientServerAddress -InterfaceAlias "Ethernet" -ServerAddresses 8.8.8.8,8.8.4.4

3、重命名计算机

Rename-Computer -NewName "MyServerCore"

重命名后需重启:

Restart-Computer

4、加入域

Add-Computer -DomainName "yourdomain.com" -Credential yourdomain\admin
Restart-Computer

5、启用远程桌面(如需)

Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\Terminal Server" -Name "fDenyTSConnections" -Value 0
Enable-NetFirewallRule -DisplayGroup "Remote Desktop"

6、启用防火墙规则(例如远程管理)

启用所有远程管理:
Enable-PSRemoting -Force
启用 Server Manager 远程管理:
Set-Item wsman:\localhost\client\trustedhosts -Value "*"

7、系统更新

通过 PowerShell 检查更新(需安装 PSWindowsUpdate 模块):
Install-PackageProvider -Name NuGet -Force
Install-Module PSWindowsUpdate -Force
Import-Module PSWindowsUpdate
Get-WindowsUpdate
Install-WindowsUpdate -AcceptAll -AutoReboot

或使用 sconfig 中的第 6 项菜单进行更新。

8、软件包管理(可选)

使用 winget(Windows 2022 和更新版本):
winget install notepad++
安装 .NET 功能:
Install-WindowsFeature Net-Framework-Core

9、查看系统信息

systeminfo

10、服务管理

启动服务:
Start-Service -Name servicename
停止服务:
Stop-Service -Name servicename
查看服务状态:
Get-Service -Name servicename

11、磁盘管理

查看磁盘列表:
Get-Disk
初始化磁盘:
Initialize-Disk -Number 1
New-Partition -DiskNumber 1 -UseMaximumSize -AssignDriveLetter
Format-Volume -DriveLetter E -FileSystem NTFS -NewFileSystemLabel "Data"

12、常用诊断命令

ping 8.8.8.8
Test-Connection google.com
ipconfig /all
Get-NetIPAddress
Get-EventLog -LogName System -Newest 20

13、远程管理建议工具

工具 描述
Windows Admin Center 现代化 Web 图形界面管理服务器(推荐)
Server Manager 通过 GUI 远程管理 Server Core
PowerShell Remoting 基于 WinRM 的远程命令行管理
RSAT 工具集 客户端用于管理远程服务器

三、Windows Admin Cente

我们可以在 Windows 11 上安装并使用 Windows Admin Center(WAC),这正是微软推荐的一种现代远程管理方式,非常适合管理 Windows Server Core、Windows Server(含 GUI 版)、甚至 Windows 10/11 客户端机器

1、Windows Admin Center 简介

Windows Admin Center(WAC) 是一个 本地部署的、基于浏览器的服务器管理平台,不依赖 Azure,可用于集中管理服务器、群集、HCI 系统及 Windows 客户端设备。

2、Windows 11 安装 WAC 的要求

项目 要求说明
操作系统 Windows 11 Pro、Enterprise 或 Education
.NET .NET Framework 4.7.2 或更高
浏览器 Microsoft Edge(推荐)或 Chrome、Firefox
权限 管理员权限(用于安装 WAC)

3、安装步骤

1. 下载 WAC 安装包:

访问微软官网或官方下载页面:

🔗 Windows Admin Center 官方下载地址

或者通过 PowerShell 脚本自动下载安装(可选):

Invoke-WebRequest -Uri https://aka.ms/WACDownload -OutFile WindowsAdminCenter.msi

2. 安装 WAC:

运行 WindowsAdminCenter.msi 安装包:

  • 接受协议

  • 默认使用 https://localhost:6516 端口(可自定义)

  • 选择“允许修改本地防火墙规则”

  • 安装完成后,WAC 会作为服务运行,并自动打开默认浏览器

3. 启动与访问

访问地址(本地):

https://localhost:6516/

如希望远程访问,请使用对应主机 IP 地址 + 端口:

https://your-ip-address:6516/

4、添加和管理目标服务器

在 WAC 控制台中:

  1. 点击“添加” → 选择“服务器”、“Windows PC”或“Azure VM”

  2. 输入目标机器名称或 IP 地址

  3. 使用管理员凭据连接

  4. 成功后可执行远程管理任务(更新、服务、事件日志、证书、用户等)

5、可管理的内容包括:

  • Windows Server Core 服务器(无 GUI)

  • Windows Server GUI(2016、2019、2022)

  • Windows 10 / 11 设备

  • Hyper-V 虚拟机和存储

  • Active Directory、证书、组策略、任务计划等

5、建议配置(可选)

为了方便远程访问,可以配置:

  • 绑定 HTTPS 证书(如 Let's Encrypt)

  • 开放防火墙端口(默认 TCP 6516)

  • 使用自定义 DNS 名称

7、总结

优点 描述
免费 官方免费工具
无需 Azure 完全本地部署,不强制接入云
可在 Windows 11 上使用 适合运维管理者和开发人员日常管理
图形化替代命令行 尤其适用于管理 Server Core 无 GUI 的系统


网站公告

今日签到

点亮在社区的每一天
去签到