解决方法:

[PowerShell] 注意后面的index2,是wim中映像包的顺序,可以通过命令获取。

获取包的index

1、 dism.exe /get-wiminfo /wimfile:d:\sources\install.wim)

Index : 1

Name :Windows Server 2012 SERVERSTANDARDCORE

Description : Windows Server 2012 SERVERSTANDARDCORE

Size : 7,195,580,708 bytes

Index : 2

Name :Windows Server 2012 SERVERSTANDARD

Description : Windows Server 2012 SERVERSTANDARD

Size : 11,999,848,937 bytes

Index : 3

Name :Windows Server 2012 SERVERDATACENTERCORE

Description : Windows Server 2012 SERVERDATACENTERCORE

Size : 7,176,243,455 bytes

Index : 4

Name :Windows Server 2012 SERVERDATACENTER

Description : Windows Server 2012 SERVERDATACENTER

Size : 11,995,224,677 bytes

我的测试是standard版,所以
2、Install-WindowsFeature Server-Gui-Shell -Source wim:d:\sources\install.wim:2

3、mkdir c:\mountdir

4、把安装光盘放在光驱或mount到光驱,这里是D盘;

4、dism /mount-wim /wimfile:d:\sources\install.wim /index:2 /mountdir:c:\mountdir /readonly

5. install-windowsfeature server-gui-mgmt-infra -source c:\mountdir\windows\winsxs,d:\sources\sxs

6.dism.exe /Unmount-Wim /MountDir:c:\mountdir /discard