系统环境如下:
OS: windows server 2022 Core DataCenter
DB: Sql Server 2022 with CU5
ADK: Windows 11 版本 22H2 的 ADK: https://learn.microsoft.com/zh-cn/windows-hardware/get-started/adk-install
1.安装sqlserver 2022:
d:\setup.exe /Q /action=install /features=SQLEngine /INSTANCEDIR="C:\Program Files\Microsoft SQL Server" /SQLCOLLATION="SQL_Latin1_General_CP1_CI_AS" /INSTALLSHAREDDIR="C:\Program Files\Microsoft SQL Server" /INSTALLSHAREDWOWDIR="C:\Program Files (x86)\Microsoft SQL Server" /INSTANCENAME=MSSQLSERVER /SQLSVCACCOUNT="y\sqladmin" /SQLSVCPASSWORD="***#2009" /SQLSYSADMINACCOUNTS="BUILTIN\Administrators" "y\scadmin" "y\ykxadmin" "y\sqladmin" /SQLSVCPASSWORD="***#2009" /AGTSVCACCOUNT="y\sqladmin" /AGTSVCPASSWORD="***#2009" /AGTSVCSTARTUPTYPE="Automatic" /BROWSERSVCSTARTUPTYPE="Automatic" /NPENABLED="1" /TCPENABLED="1" /skiprules=servercoreblockunsupportedfeaturescheck /iacceptsqlserverlicenseterms /IACCEPTROPENLICENSETERMS
Install-Module -Name sqlserver -Scope AllUsers -Force
Invoke-SqlCmd -query "select @@version" -ServerInstance "localhost" -Encrypt Optional |fl
安装更新:
D:\SQLServer2022-KB5026806-x64-CU5.exe /qs /IAcceptSQLServerLicenseTerms /Actinotallow=Patch /INSTANCENAME="MSSQLSERVER"
2.安装ADK:
MD C:\ADK
D:\ADK\adksetup.exe /quiet /installpath C:\ADK /features OptionId.DeploymentTools
Get-CimInstance -ClassName Win32_Product |select Name
D:\ADKWinPEAddons\adkwinpesetup.exe /quiet /installpath C:\ADK /features OptionId.WindowsPreinstallationEnvironment /forcerestart
3.配置服务帐户和分布式密钥管理
新建域账号:vmmsvc
新建容器:vmmdkm
将y\vmmsvc 域账号加入本地管理员组:
Net localgroup Administrators y\vmmsvc /add
Get-LocalGroupMember Administrators
新建配置文件:C:\VMServer.ini
[OPTIONS]
ProductKey=BXH69-M62YX-QQD6R-3GPWX-8WMFY
UserName=ICT
CompanyName=MSFT
ProgramFiles=C:\Program Files\Microsoft system Center 2022\Virtual Machine Manager
CreateNewSqlDatabase=1
SqlInstanceName=MSSQLSERVER
SqlDatabaseName=DB_VMM2022
RemoteDatabaseImpersonation=1
SqlMachineName=SCVMM
IndigoTcpPort=8100
IndigoHTTPSPort=8101
IndigoNETTCPPort=8102
IndigoHTTPPort=8103
WSManTcpPort=5985
BitsTcpPort=4443
CreateNewLibraryShare=1
LibraryShareName=MSSCVMMLibrary
LibrarySharePath=C:\MSSCVMMLibrary
LibraryShareDescription=Virtual Machine Manager Library Files
SQMOptIn=0
MUOptIn=0
VmmServiceLocalAccount=0
TopContainerName=CN=VMMDKM,OU=SCVMM,DC=artingykx,DC=com
HighlyAvailable=0
VmmServerName=SCVMM
MD C:\MSSCVMMLibrary
4.安VMM:
d:\Setup.exe /server /i /f C:\VMServer.ini /SqlDBAdminDomain y /SqlDBAdminName sqladmin /SqlDBAdminPassword ***#2009 /VmmServiceDomain y /VmmServiceUserName vmmsvc /VmmServiceUserPassword ***#2009 /IACCEPTSCEULA
注意:密码不能包含 &,<<等特殊字符。
如果安装程序未成功完成,请查阅 %SYSTEMDRIVE%\ProgramData\VMMLogs 文件夹中的 日志文件。 ProgramData 为隐藏文件夹
最后确定VMM服务是否正常运行:
Get-Service *VMM* |ft -AutoSize
5.安装VMM更新:
安装更新前版本:
安装更新UR1:kb5019202
msiexec.exe /update D:\updates\UR1\kb5019202_vmmserver_amd64.msp
更新完后版本变化: