1. 首页 > IT综合教程 > 正文

81. Windows Server 2022管理培训

一、Windows Server 2022概述

Windows Server 2022是微软最新的服务器操作系统,提供增强的安全性、性能和可靠性,适用于现代数据中心和混合云环境。

from 培训视频:www.itpux.com

1.1 核心特性

  • 增强安全性:安全核心服务器、Windows Defender ATP集成
  • 性能提升:支持48TB内存、2048逻辑处理器
  • 混合云集成:Azure Arc、Azure Backup
  • 存储优化:Storage Spaces Direct、Storage Replica

1.2 版本对比

版本 适用场景 核心限制
Datacenter 大型数据中心 无限制
Standard 中小型企业 2个虚拟机
Essentials 小型企业 25用户

二、安装与配置

2.1 系统要求

# 最低硬件要求
处理器: 1.4 GHz 64位处理器
内存: 512 MB (2 GB推荐)
存储: 32 GB (更多空间推荐)
网络: 1 Gbps网卡
显示器: 1024x768分辨率
# 推荐硬件要求
处理器: 2 GHz 64位多核处理器
内存: 8 GB以上
存储: 100 GB SSD
网络: 10 Gbps网卡

2.2 安装步骤

1. 下载Windows Server 2022 ISO镜像
2. 创建启动U盘或挂载ISO
3. 启动服务器,从安装介质引导
4. 选择语言和区域设置
5. 点击"安装现在"
6. 选择操作系统版本
7. 接受许可条款
8. 选择"自定义: 仅安装Windows (高级)"
9. 选择或创建分区
10. 开始安装,等待完成
11. 设置管理员密码
12. 登录系统

2.3 初始配置

# 服务器管理器初始化
1. 打开服务器管理器
2. 点击"本地服务器"
3. 配置计算机名
4. 配置网络设置
5. 启用远程桌面
6. 配置Windows更新
# 命令行配置
# 重命名计算机
Rename-Computer -NewName "Server01" -Restart
# 配置IP地址
New-NetIPAddress -InterfaceAlias "Ethernet" -IPAddress "192.168.1.100" -PrefixLength 24 -DefaultGateway "192.168.1.1"
Set-DnsClientServerAddress -InterfaceAlias "Ethernet" -ServerAddresses "8.8.8.8", "8.8.4.4"
# 启用远程桌面
Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\Terminal Server" -Name "fDenyTSConnections" -Value 0
Enable-NetFirewallRule -DisplayGroup "Remote Desktop"
# 激活Windows
slmgr /ipk XXXXX-XXXXX-XXXXX-XXXXX-XXXXX
slmgr /ato

三、服务器角色与功能

3.1 角色安装

# 使用服务器管理器安装角色
1. 打开服务器管理器
2. 点击"添加角色和功能"
3. 选择"基于角色或基于功能的安装"
4. 选择目标服务器
5. 选择要安装的角色
6. 选择相关功能
7. 完成安装
# 使用PowerShell安装角色
# 安装AD域服务
Install-WindowsFeature -Name AD-Domain-Services -IncludeManagementTools
# 安装DNS服务器
Install-WindowsFeature -Name DNS -IncludeManagementTools
# 安装IIS
Install-WindowsFeature -Name Web-Server -IncludeAllSubFeature -IncludeManagementTools
# 安装DHCP服务器
Install-WindowsFeature -Name DHCP -IncludeManagementTools
# 安装文件服务器
Install-WindowsFeature -Name File-Services -IncludeManagementTools
# 查看已安装角色
Get-WindowsFeature | Where-Object {$_.InstallState -eq "Installed"}

3.2 常见角色配置

# AD域控制器配置
Install-ADDSForest -DomainName "fgedu.net.cn" -SafeModeAdministratorPassword (ConvertTo-SecureString "Password123!" -AsPlainText -Force)
# DNS区域配置
Add-DnsServerPrimaryZone -Name "fgedu.net.cn" -ZoneFile "fgedu.net.cn.dns"
Add-DnsServerResourceRecordA -ZoneName "fgedu.net.cn" -Name "server" -IPv4Address "192.168.1.100"
# IIS网站配置
New-WebSite -Name "Default Web Site" -Port 80 -PhysicalPath "C:\inetpub\wwwroot"
# DHCP作用域配置
Add-DhcpServerV4Scope -Name "Scope1" -StartRange "192.168.1.100" -EndRange "192.168.1.200" -SubnetMask "255.255.255.0"
Set-DhcpServerV4OptionValue -ScopeId "192.168.1.0" -DnsServer "192.168.1.100" -Router "192.168.1.1"
# 文件共享配置
New-SmbShare -Name "SharedFolder" -Path "C:\Shares\Data" -FullAccess "Everyone"
Set-SmbShareAccess -Name "SharedFolder" -AccountName "Users" -AccessRight Read

四、存储管理

4.1 磁盘管理

# 查看磁盘
Get-Disk
# 初始化磁盘
Initialize-Disk -Number 1 -PartitionStyle GPT
# 创建分区
New-Partition -DiskNumber 1 -UseMaximumSize -DriveLetter F
# 格式化卷
Format-Volume -DriveLetter F -FileSystem NTFS -NewFileSystemLabel "Data"
# 扩展卷
Resize-Partition -DriveLetter C -Size (Get-PartitionSupportedSize -DriveLetter C).SizeMax
# 磁盘配额
Enable-DiskQuota -Path "F:\"
Set-DiskQuota -Path "F:\" -DefaultLimit 10GB -DefaultWarningLimit 8GB
# 存储空间
New-StoragePool -FriendlyName "Pool1" -StorageSubsystemFriendlyName "Windows Storage*" -PhysicalDisks (Get-PhysicalDisk | Where-Object {$_.CanPool -eq $true})
New-VirtualDisk -StoragePoolFriendlyName "Pool1" -FriendlyName "VDisk1" -Size 100GB -ProvisioningType Thin
Get-VirtualDisk -FriendlyName "VDisk1" | Get-Disk | Initialize-Disk -PartitionStyle GPT
Get-VirtualDisk -FriendlyName "VDisk1" | Get-Disk | New-Partition -UseMaximumSize -DriveLetter G
Format-Volume -DriveLetter G -FileSystem NTFS -NewFileSystemLabel "StoragePool"

4.2 存储复制

# 启用Storage Replica
Install-WindowsFeature -Name Storage-Replica -IncludeManagementTools
# 配置复制伙伴
New-SRPartnership -SourceComputerName "Server01" -SourceRGName "SourceRG" -SourceVolumeName "F:" -SourceLogVolumeName "E:" -DestinationComputerName "Server02" -DestinationRGName "DestRG" -DestinationVolumeName "F:" -DestinationLogVolumeName "E:"
# 查看复制状态
Get-SRGroup
Get-SRPartnership
# 故障转移
Set-SRPartnership -NewSourceComputerName "Server02" -SourceRGName "DestRG" -DestinationComputerName "Server01" -DestinationRGName "SourceRG"
# 测试故障转移
Test-SRTopology -SourceComputerName "Server01" -SourceVolumeName "F:" -SourceLogVolumeName "E:" -DestinationComputerName "Server02" -DestinationVolumeName "F:" -DestinationLogVolumeName "E:" -DurationInMinutes 30

五、网络管理

5.1 网络配置

# 查看网络适配器
Get-NetAdapter
# 配置网络适配器
Rename-NetAdapter -Name "Ethernet" -NewName "LAN"
Set-NetIPInterface -InterfaceAlias "LAN" -Dhcp Disabled
New-NetIPAddress -InterfaceAlias "LAN" -IPAddress "192.168.1.100" -PrefixLength 24 -DefaultGateway "192.168.1.1"
Set-DnsClientServerAddress -InterfaceAlias "LAN" -ServerAddresses "192.168.1.100", "8.8.8.8"
# 配置防火墙
Get-NetFirewallProfile
Set-NetFirewallProfile -Profile Domain,Public,Private -Enabled True
New-NetFirewallRule -DisplayName "HTTP" -Direction Inbound -LocalPort 80 -Protocol TCP -Action Allow
New-NetFirewallRule -DisplayName "RDP" -Direction Inbound -LocalPort 3389 -Protocol TCP -Action Allow
# 配置NIC Teaming
New-NetLbfoTeam -Name "Team1" -TeamMembers "Ethernet1", "Ethernet2" -TeamingMode SwitchIndependent -LoadBalancingAlgorithm Dynamic
# 配置QoS
New-NetQosPolicy -Name "Voice" -AppPathNameMatchCondition "Lync.exe" -ThrottleRateActionBitsPerSecond 10000000 -PriorityValue8021Action 6
# 网络诊断
Test-Connection -ComputerName "192.168.1.1" -Count 4
Test-NetConnection -ComputerName "google.com" -Port 80
Get-NetRoute | Where-Object {$_.DestinationPrefix -eq "0.0.0.0/0"}

5.2 远程管理

# 启用WinRM
Enable-PSRemoting -Force
# 配置防火墙
Set-NetFirewallRule -Name "WINRM-HTTP-In-TCP" -Enabled True
# 测试远程连接
Test-WSMan -ComputerName "Server02"
# 远程执行命令
Invoke-Command -ComputerName "Server02" -ScriptBlock { Get-Service }
# 远程会话
Enter-PSSession -ComputerName "Server02"
# 复制文件
Copy-Item -Path "C:\Scripts\script.ps1" -Destination "\Server02\C$\Scripts\" -Force
# 配置远程管理组
Add-LocalGroupMember -Group "Remote Management Users" -Member "User1"
# 启用远程协助
Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\Remote Assistance" -Name "fAllowToGetHelp" -Value 1

六、用户与权限管理

6.1 本地用户管理

# 查看本地用户
Get-LocalUser
# 创建本地用户
New-LocalUser -Name "User1" -FullName "Test User" -Password (ConvertTo-SecureString "Password123!" -AsPlainText -Force) -PasswordNeverExpires
# 修改用户属性
Set-LocalUser -Name "User1" -Description "Test user account"
# 禁用用户
Disable-LocalUser -Name "User1"
# 删除用户
Remove-LocalUser -Name "User1"
# 本地组管理
Get-LocalGroup
Add-LocalGroupMember -Group "Administrators" -Member "User1"
Remove-LocalGroupMember -Group "Administrators" -Member "User1"
# 本地安全策略
secedit /export /cfg C:\secpol.cfg
secedit /configure /db C:\Windows\security\local.sdb /cfg C:\secpol.cfg

6.2 域用户管理

# 创建AD用户
New-ADUser -Name "User1" -GivenName "John" -Surname "Doe" -SamAccountName "jdoe" -UserPrincipalName "jdoe@fgedu.net.cn" -AccountPassword (ConvertTo-SecureString "Password123!" -AsPlainText -Force) -Enabled $true
# 修改AD用户
Set-ADUser -Identity "jdoe" -Description "IT Administrator" -Department "IT"
# 禁用AD用户
Disable-ADAccount -Identity "jdoe"
# 删除AD用户
Remove-ADUser -Identity "jdoe" -Confirm:$false
# AD组管理
New-ADGroup -Name "IT Admins" -GroupScope Global -GroupCategory Security
Add-ADGroupMember -Identity "IT Admins" -Members "jdoe"
# 权限管理
Get-ACL "C:\Data" | Format-List
Set-ACL -Path "C:\Data" -AclObject (Get-ACL "C:\Template")
# 委派控制
# 使用AD用户和计算机控制台
# 右键组织单位 -> 委派控制

七、安全管理

7.1 安全配置

# 启用安全核心服务器
# 在安装时选择"安全核心服务器"选项
# 或使用PowerShell
Install-WindowsFeature -Name Server-Core -IncludeAllSubFeature
# 配置Windows Defender
Set-MpPreference -DisableRealtimeMonitoring $false
Update-MpSignature
Get-MpThreat
# 配置BitLocker
Enable-BitLocker -MountPoint "C:" -RecoveryPasswordProtector
Backup-BitLockerKeyProtector -MountPoint "C:" -KeyProtectorId (Get-BitLockerVolume -MountPoint "C:").KeyProtector[0].KeyProtectorId -Password (ConvertTo-SecureString "Password123!" -AsPlainText -Force) -Path "C:\BitLockerRecovery.txt"
# 配置Windows Firewall
Get-NetFirewallProfile | Set-NetFirewallProfile -Enabled True
New-NetFirewallRule -DisplayName "SSH" -Direction Inbound -LocalPort 22 -Protocol TCP -Action Allow
# 配置LAPS
Install-WindowsFeature -Name RSAT-LAPS
Update-AdmPwdADSchema
Set-AdmPwdComputerSelfPermission -OrgUnit "OU=Servers,DC=example,DC=com"
# 安全基线
# 下载并应用Microsoft安全基线
# https://docs.microsoft.com/en-us/windows/security/threat-protection/security-baselines

7.2 事件日志管理

# 查看事件日志
Get-EventLog -LogName System -Newest 10
Get-WinEvent -LogName Security -MaxEvents 10
# 配置事件日志
wevtutil sl System /ms:10485760
wevtutil sl Security /ms:20971520
# 导出事件日志
wevtutil epl System C:\System.evtx
# 清除事件日志
Clear-EventLog -LogName Application,System,Security
# 事件转发
# 配置源计算机
wecutil qc
# 配置收集服务器
# 使用事件查看器 -> 订阅

八、故障排除

8.1 系统诊断

# 系统信息
SystemInfo
Get-ComputerInfo
# 服务状态
Get-Service | Where-Object {$_.Status -eq "Running"}
Get-Service | Where-Object {$_.Status -eq "Stopped"}
# 进程管理
Get-Process | Sort-Object CPU -Descending | Select-Object -First 10
Stop-Process -Name "notepad" -Force
# 性能监控
Get-Counter -Counter "\Processor(_Total)\% Processor Time" -SampleInterval 5 -MaxSamples 10
Get-Counter -Counter "\Memory\Available MBytes"
# 磁盘性能
Get-Counter -Counter "\PhysicalDisk(*)\% Disk Time"
# 网络诊断
ipconfig /all
ping 192.168.1.1
nslookup google.com
netstat -an
# 启动项
Get-CimInstance -ClassName Win32_StartupCommand
Get-Service | Where-Object {$_.StartType -eq "Automatic"}
# 系统文件检查
sfc /scannow
# 磁盘检查
chkdsk C: /f /r
# 内存测试
mdsched.exe

8.2 常见故障处理

# 启动问题
# 进入安全模式
# 使用启动修复
bootrec /fixmbr
bootrec /fixboot
bootrec /scanos
bootrec /rebuildbcd
# 服务无法启动
# 检查服务依赖
sc query "ServiceName"
sc qc "ServiceName"
# 网络连接问题
# 重置网络
netsh winsock reset
netsh int ip reset
ipconfig /release
ipconfig /renew
# 权限问题
# 检查NTFS权限
icacls "C:\Data"
# 登录失败
# 检查账户状态
Get-ADUser -Identity "jdoe" -Properties AccountExpirationDate,LockedOut
Unlock-ADAccount -Identity "jdoe"
# 性能问题
# 检查资源使用
Taskmgr
Get-Process | Sort-Object WorkingSet -Descending | Select-Object -First 10
# 蓝屏故障
# 查看转储文件
# 使用WinDbg分析
Get-WinEvent -FilterHashtable @{LogName='System';ID=1001} | Format-List

九、最佳实践

配置项 建议值 说明
Windows更新 启用自动更新 及时修补安全漏洞
防火墙 启用并配置规则 限制不必要的访问
账户管理 使用最小权限 减少安全风险
备份 定期备份 数据安全保障
监控 启用事件日志 及时发现问题
注意事项:

  • 定期更新系统补丁
  • 备份重要数据
  • 使用强密码策略
  • 限制管理员权限
  • 监控系统性能

十、总结

, 学习交流加群风哥QQ113257174

Windows Server 2022是功能强大的服务器操作系统。通过本培训文档,您应该掌握了:

  • Windows Server 2022安装与配置
  • 服务器角色与功能部署
  • 存储管理与优化
  • 网络配置与远程管理
  • 用户与权限管理
  • 安全配置与故障排除
IT运维培训文档系列 | 第81篇 | Windows Server 2022管理培训

本文由风哥教程整理发布,仅用于学习测试使用,转载注明出处:http://www.fgedu.net.cn/10327.html

联系我们

在线咨询:点击这里给我发消息

微信号:itpux-com

工作日:9:30-18:30,节假日休息