Hi there,

Ever tried to create a Windows 8 VirtualDesktop collection (VDI) on Windows Server 2012 Remote Desktop Services? Yes? And did you try to add a custom answer file to it? With PowerShell?

If you answered the questions above with yes you probably find out that it’s not gonna work out of the box and you already found my question at TechNet (link).

I’ll show you what i did to get it working. It’s simple but you didn’t expect it…

Create a Windows 8 VDI collection on RDS 2012

My PowerShell command to create a virtual desktop collection looks like this:

New-RDVirtualDesktopCollection `
-CollectionName "Personal Managed Win8" `
-Description "Some personal Windows 8 VDI machines." `
-OU "VDI" `
-ConnectionBroker "RDSCB01.lab.local" `
-PersonalManaged `
-CustomSysprepUnattendFilePath "\\hyper02.lab.local\_Unattend\OOBE.xml" `
-VirtualDesktopAllocation @{"hyper02.lab.local"=1} `
-VirtualDesktopNamePrefix "VDI-P-" `
-UserGroups "lab.local\domain users" `
-VirtualDesktopTemplateHostServer "hyper02.lab.local" `
-VirtualDesktopTemplateName “_Template_Win8” `
-StorageType LocalStorage `
-LocalStoragePath "E:\_VDI" `
-Force `
-Debug

I’m not going to discuss all the PowerShell options here. I’ll write a separate article for that soon, i promise… All the parameters are listed over here: http://technet.microsoft.com/en-us/library/jj215448.aspx

It’s all about the following parameter:

-CustomSysprepUnattendFilePath "\\hyper02.lab.local\_Unattend\OOBE.xml"

So you need a custom answer file right? Well, you open the Windows System Image Manager add the options need for a unattended “Out of the Box Experience”….And it will look something like this:

<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend">
    <settings pass="oobeSystem">
        <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">
            <OOBE>
                <HideEULAPage>true</HideEULAPage>
                <HideLocalAccountScreen>true</HideLocalAccountScreen>
                <HideOEMRegistrationScreen>true</HideOEMRegistrationScreen>
                <HideOnlineAccountScreens>true</HideOnlineAccountScreens>
                <HideWirelessSetupInOOBE>true</HideWirelessSetupInOOBE>
                <NetworkLocation>Work</NetworkLocation>
                <ProtectYourPC>3</ProtectYourPC>
                <SkipMachineOOBE>true</SkipMachineOOBE>
                <SkipUserOOBE>true</SkipUserOOBE>
            </OOBE>
            <UserAccounts>
                <AdministratorPassword>
                    <Value>UABhAHMAcwB3AG8AcgBkACEAQQBkAG0AaQBuAGkAcwB0AHIAYQB0AG8AcgBQAGEAcwBzAHcAbwByAGQA</Value>
                    <PlainText>false</PlainText>
                </AdministratorPassword>
                <LocalAccounts>
                    <LocalAccount wcm:action="add">
                        <Password>
                            <Value>UABhAHMAcwB3AG8AcgBkACEAUABhAHMAcwB3AG8AcgBkAA==</Value>
                            <PlainText>false</PlainText>
                        </Password>
                        <Description>Local Administrator</Description>
                        <DisplayName>LocalAdmin</DisplayName>
                        <Group>Administrators</Group>
                        <Name>LocalAdmin</Name>
                    </LocalAccount>
                </LocalAccounts>
            </UserAccounts>
        </component>
        <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>en-US</InputLocale>
            <SystemLocale>en-US</SystemLocale>
            <UserLocale>nl-NL</UserLocale>
            <UILanguage>en-US</UILanguage>
            <UILanguageFallback>en-US</UILanguageFallback>
        </component>
    </settings>
</unattend>

You just build the answer file with the Windows System Image Manager, so this will work flawlessly right?

NO WAY!!!!

After running the command it’s going to export the template VM and doing some other stuff, but than…you’ll receive the following error in PowerShell:

PS N:\> \\dc01\isos\New-VirtualDesktopCollection.ps1
Unable to retrieve the details of the virtual desktop collection.
    + CategoryInfo          : WriteError: (:) [Start-RDVMRollout], RDManagementException
    + FullyQualifiedErrorId : StartRDVirtualMachineRollout,Microsoft.RemoteDesktopServices.Management.Cmdlets.StartRDVirtualMachineRo 
   lloutCommand
    + PSComputerName        : localhost

CollectionName    Type              Size       PercentInUse   
--------------    ----              ----       ------------   
Pooled Managed... PooledManaged     0          0              

writeErrorStream      : True
OriginInfo            : localhost
Exception             : System.Management.Automation.RemoteException: Unable to retrieve the details of the virtual desktop 
                        collection.
TargetObject          : 
CategoryInfo          : WriteError: (:) [Start-RDVMRollout], RDManagementException
FullyQualifiedErrorId : StartRDVirtualMachineRollout,Microsoft.RemoteDesktopServices.Management.Cmdlets.StartRDVirtualMachineRolloutCo
                        mmand
ErrorDetails          : 
InvocationInfo        : 
ScriptStackTrace      : 
PipelineIterationInfo : {}
PSMessageDetails      :

Wow….what does that mean? The only thing I can see here is that the process fails at the point RDS wants to deploy the first VM….Still not very useful don’t you think?

Without the answer file parameter is runs perfectly, BUT the VDI machines get the OOBE…. That’s not what we want off course….

This link (http://support.microsoft.com/kb/2747656?wa=wsignin1.0) and other sources tell me that when i set the regkeys i can find a log in c:\windows\logs, but there is nothing. I looked on the management server and the connection broker.

The only thing I could find in the event viewer was this:

The XML input specified for the VM Provisioning job is not in a valid format. Error: 0xC00CEE03
Input XML:

<?xml version="1.0"?>
	<rdvp:RDVProvisioning xmlns:rdvp="http://www.microsoft.com/rdv/2010/05/">
		<rdvp:ProvisionPoolRequest><rdvp:Job>
		<rdvp:Action>Create</rdvp:Action>
		<rdvp:OnError>Stop</rdvp:OnError></rdvp:Job>
		<rdvp:Pool><rdvp:Name>Pooled_Managed_W</rdvp:Name>
		<rdvp:Type></rdvp:Type>
		<rdvp:VhdType>DiffDisk</rdvp:VhdType>
		<rdvp:SaveDelay></rdvp:SaveDelay>
		<rdvp:Version></rdvp:Version>
		<rdvp:MARK_HA>No</rdvp:MARK_HA></rdvp:Pool>
		<rdvp:Vm>
			<rdvp:BaseVmLocation>\\RDSCB01\RDVirtualDesktopTemplate\Pooled_Managed_W\IMGS\__3</rdvp:BaseVmLocation>
			<rdvp:LocalVmCreationPath>E:\_VDI</rdvp:LocalVmCreationPath>
			<rdvp:LocalGoldCachePath></rdvp:LocalGoldCachePath>
			<rdvp:SMBShare></rdvp:SMBShare>
			<rdvp:EnableVmStreaming>0</rdvp:EnableVmStreaming>
			<rdvp:RunVMsFromSMB>0</rdvp:RunVMsFromSMB>
			<rdvp:NamingPrefix>Pooled-Win8</rdvp:NamingPrefix>
			<rdvp:NamingStartIndex>1</rdvp:NamingStartIndex>
			<rdvp:Domain>lab.local</rdvp:Domain>
			<rdvp:OU>OU=VDI,OU=Computers,OU=Kamer 2101,DC=lab,DC=local</rdvp:OU>
			<rdvp:ProductKey></rdvp:ProductKey>
			<rdvp:UnattendXml>
				<![CDATA[<?xml version="1.0" encoding="utf-8"?> 
					<unattend xmlns="urn:schemas-microsoft-com:unattend">     
						<settings pass="oobeSystem"> 		
							*********Settings***********     
						</settings> 
					</unattend>]]>
			</rdvp:UnattendXml>
		</rdvp:Vm>
		<rdvp:HyperVHosts>
			<rdvp:HyperVHost>
				<rdvp:Name>hyper02.lab.local</rdvp:Name>
					<rdvp:NumberVms>3</rdvp:NumberVms>
				</rdvp:HyperVHost>
			</rdvp:HyperVHosts>
		</rdvp:ProvisionPoolRequest>
	</rdvp:RDVProvisioning>
----------------------------------------------------------------------
Log Name: 	Microsoft-Windows-TerminalServices-SessionBroker/Admin
Source:		TerminalServices-SessionBroker
EventID:	1549
Level:		Error
User:		NETWORK SERVICE
Task Category:	MS VM Provisioning Plugin
Computer:	RDSCB01.lab.local

As you can see here is that RDS creates a XML file and puts your XML file into it. After reading this error for 30 times (yeah, I know…) I noticed that the <xml> was opened twice…Maybe that’s the whole problem, the xml file RDS created already says to the machine <rdvp:UnattendXml> and is like: “Hey, here are the unattend settings!” So why openening a new xml file inside there?

So I removed the first line of the XML file:

<?xml version="1.0" encoding="utf-8"?>

I started the command again and it runs unattended…PERFECTLY!!!!!

NOTE: Everytime that you edit the XML file with the Windows System Image Manager the line is reinserted! So you have to remove the first line from the XML file every time you edit it.

Good Luck!

Download working unattend file (OOBE.xml)