我正在创建一个基础虚拟机,作为我希望成为我经常使用的所有机器配置的虚拟机树的开始。
在这台基础机器上,我有一个 10GB 的小型系统驱动器和一个 40GB 的大型数据驱动器。当我对虚拟机进行系统准备时,它会删除额外的硬盘驱动器。它仍然出现,但服务器管理器报告它处于离线状态。
我的答案文件中有以下内容
<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend">
<settings pass="specialize">
<component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ComputerName></ComputerName>
<RegisteredOrganization>XXXXXX</RegisteredOrganization>
<RegisteredOwner>XXXXXX</RegisteredOwner>
<ShowWindowsLive>false</ShowWindowsLive>
</component>
<component name="Microsoft-Windows-Security-Licensing-SLC-UX" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SkipAutoActivation>true</SkipAutoActivation>
</component>
<component name="Microsoft-Windows-IE-ESC" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<IEHardenAdmin>false</IEHardenAdmin>
<IEHardenUser>false</IEHardenUser>
</component>
</settings>
<settings pass="oobeSystem">
<component name="Microsoft-Windows-International-Core" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<InputLocale>0809:00000809</InputLocale>
<SystemLocale>en-GB</SystemLocale>
<UILanguage>en-GB</UILanguage>
<UserLocale>en-GB</UserLocale>
</component>
<component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<RegisteredOrganization>Company Name</RegisteredOrganization>
<RegisteredOwner>Company Name</RegisteredOwner>
<UserAccounts>
<AdministratorPassword>
<Value>cwBoAEAAcgBlAHAAbwAxAG4AdABBAGQAbQBpAG4AaQBzAHQAcgBhAHQAbwByAFAAYQBzAHMAdwBvAHIAZAA=</Value>
<PlainText>false</PlainText>
</AdministratorPassword>
</UserAccounts>
<AutoLogon>
<Password>
<Value>cwBoAEAAcgBlAHAAbwAxAG4AdABQAGEAcwBzAHcAbwByAGQA</Value>
<PlainText>false</PlainText>
</Password>
<Domain>WORKGROUP</Domain>
<Enabled>true</Enabled>
<LogonCount>2</LogonCount>
<Username>Administrator</Username>
</AutoLogon>
<OOBE>
<HideEULAPage>true</HideEULAPage>
<NetworkLocation>Work</NetworkLocation>
<ProtectYourPC>3</ProtectYourPC>
</OOBE>
<Display>
<ColorDepth>32</ColorDepth>
<HorizontalResolution>1440</HorizontalResolution>
<VerticalResolution>900</VerticalResolution>
</Display>
<TimeZone>GMT Standard Time</TimeZone>
</component>
</settings>
<settings pass="generalize">
<component name="Microsoft-Windows-ServerManager-SvrMgrNc" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<DoNotOpenServerManagerAtLogon>true</DoNotOpenServerManagerAtLogon>
</component>
<component name="Microsoft-Windows-OutOfBoxExperience" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<DoNotOpenInitialConfigurationTasksAtLogon>true</DoNotOpenInitialConfigurationTasksAtLogon>
</component>
</settings>
<settings pass="windowsPE">
<component name="Microsoft-Windows-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<DiskConfiguration>
<WillShowUI>OnError</WillShowUI>
<Disk wcm:action="add">
<ModifyPartitions>
<ModifyPartition wcm:action="modify">
<Active>true</Active>
<Letter>D</Letter>
<PartitionID>1</PartitionID>
<Label>Data</Label>
<Order>1</Order>
</ModifyPartition>
</ModifyPartitions>
<DiskID>1</DiskID>
<WillWipeDisk>false</WillWipeDisk>
</Disk>
</DiskConfiguration>
</component>
</settings>
<cpi:offlineImage cpi:source="catalog:c:/users/chalee/desktop/install_windows server 2008 r2 serverenterprise.clg" xmlns:cpi="urn:schemas-microsoft-com:cpi" />
</unattend>
我曾假设“修改分区”部分会将我的第二个驱动器设置为在线,但没有成功!
有人能帮忙吗?应如何配置应答文件以启用第二个驱动器?
答案1
我通过编写 diskpart 脚本解决了这个问题。
脚本非常简单:
select disk 1
online disk
我将其保存为 c:\windows\setup\scripts\partdisk.txt
然后我创建了一个如下的 cmd 脚本:
partdisk /s c:\windows\setup\scripts\partdisk.txt
它被添加到 c:\windows\setup\scripts 中的 Setupcomplete.cmd 文件中(如果不存在则创建它),在 sysprepped 计算机首次启动时,Windows 安装完成后执行此脚本。
这解决了这个问题,但它将是通往可用且有用的 VM 映像顺利树的道路上众多问题中的第一个。
答案2
如果我是你,我会在没有第二个磁盘的虚拟机上创建安装,关闭它,然后复制 .vmdk(普通的;还有 -flat 的)。在文本编辑器(如 vi)中编辑它们(只需在一个上完成,我不记得是哪一个),在顶部(前 5 行左右)你应该找到虚拟机的名称。将其以及 vmdk 的名称更改为新虚拟机的名称,然后在 vSphere 客户端中创建虚拟机。
选择要使用的硬盘时,只需选择现有硬盘,指向您刚刚编辑和重命名的文件,然后选中“完成前编辑选项”。然后添加任意大小的新空硬盘。之后您可以启动它并对 VM 进行系统准备,一切都应该没问题。