WDS部署windows2012的unattend文件
来源:互联网 发布:sd卡损坏怎么恢复数据 编辑:程序博客网 时间:2024/06/06 20:04
通过WDS部署windows2012:
1. 自动安装部署
2. 设置winRM
3. 设置firewall, enable remote desktop
client的unattend.xml
<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend">
<settings pass="windowsPE">
<component name="Microsoft-Windows-International-Core-WinPE" 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">
<SetupUILanguage>
<WillShowUI>Never</WillShowUI>
<UILanguage>zh-CN</UILanguage>
</SetupUILanguage>
<InputLocale>zh-CN</InputLocale>
<SystemLocale>zh-CN</SystemLocale>
<UILanguage>zh-CN</UILanguage>
<UILanguageFallback>zh-CN</UILanguageFallback>
<UserLocale>zh-CN</UserLocale>
</component>
<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>
<Disk wcm:action="add">
<CreatePartitions>
<CreatePartition wcm:action="add">
<Order>1</Order>
<Size>384</Size>
<Type>Primary</Type>
</CreatePartition>
<CreatePartition wcm:action="add">
<Order>2</Order>
<Extend>true</Extend>
<Type>Primary</Type>
</CreatePartition>
</CreatePartitions>
<ModifyPartitions>
<ModifyPartition wcm:action="add">
<Active>true</Active>
<Format>NTFS</Format>
<Label>System Reserved</Label>
<PartitionID>1</PartitionID>
<Order>1</Order>
</ModifyPartition>
<ModifyPartition wcm:action="add">
<Active>false</Active>
<Order>2</Order>
<PartitionID>2</PartitionID>
</ModifyPartition>
</ModifyPartitions>
<DiskID>0</DiskID>
<WillWipeDisk>true</WillWipeDisk>
</Disk>
<WillShowUI>Never</WillShowUI>
</DiskConfiguration>
<DynamicUpdate>
<Enable>true</Enable>
<WillShowUI>Never</WillShowUI>
</DynamicUpdate>
<UserData>
<AcceptEula>true</AcceptEula>
</UserData>
<WindowsDeploymentServices>
<Login>
<Credentials>
<Domain>local</Domain>
<Password>R00t</Password>
<Username>Administrator</Username>
</Credentials>
<WillShowUI>Never</WillShowUI>
</Login>
<ImageSelection>
<InstallImage>
<ImageGroup>WIN2012</ImageGroup>
<ImageName>Windows Server 2012 R2 SERVERDATACENTER</ImageName>
<Filename>install-(4).wim</Filename>
</InstallImage>
<InstallTo>
<DiskID>0</DiskID>
<PartitionID>2</PartitionID>
</InstallTo>
<WillShowUI>Never</WillShowUI>
</ImageSelection>
</WindowsDeploymentServices>
</component>
</settings>
<cpi:offlineImage cpi:source="wim:e:/install.wim#Windows Server 2012 R2 SERVERDATACENTERCORE" xmlns:cpi="urn:schemas-microsoft-com:cpi" />
</unattend>
image的unattend.xml
<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend">
<settings pass="offlineServicing">
<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>HP</RegisteredOrganization>
<RegisteredOwner>Moonshot</RegisteredOwner>
</component>
</settings>
<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">
<AutoLogon>
<Password>
<Value>R00t</Value>
<PlainText>false</PlainText>
</Password>
<Enabled>true</Enabled>
<LogonCount>5</LogonCount>
<Username>Administrator</Username>
</AutoLogon>
<ComputerName>%MACHINENAME%</ComputerName>
<ProductKey>xxxxxxxxxxxxxxxxxxxxxxxx</ProductKey>
<RegisteredOrganization>xx</RegisteredOrganization>
<RegisteredOwner>xxxxxxxx</RegisteredOwner>
<TimeZone>Pacific Standard Time</TimeZone>
</component>
<component name="Networking-MPSSVC-Svc" 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">
<FirewallGroups>
<FirewallGroup wcm:action="add" wcm:keyValue="FileAndPrinterSharing">
<Active>true</Active>
<Group>File and Printer Sharing</Group>
<Profile>all</Profile>
</FirewallGroup>
<FirewallGroup wcm:action="add" wcm:keyValue="WMI">
<Active>true</Active>
<Group>Windows Management Instrumentation (WMI)</Group>
<Profile>all</Profile>
</FirewallGroup>
<FirewallGroup wcm:action="add" wcm:keyValue="RemoteDesktop">
<Active>true</Active>
<Group>Remote Desktop</Group>
<Profile>all</Profile>
</FirewallGroup>
</FirewallGroups>
</component>
<component name="Microsoft-Windows-TerminalServices-LocalSessionManager" 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">
<fDenyTSConnections>false</fDenyTSConnections>
</component>
<component name="Microsoft-Windows-TerminalServices-RDP-WinStationExtensions" 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">
<UserAuthentication>0</UserAuthentication>
</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-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>
</OOBE>
<RegisteredOwner>Moonshot</RegisteredOwner>
<RegisteredOrganization>HP</RegisteredOrganization>
<TimeZone>Pacific Standard Time</TimeZone>
<AutoLogon>
<Password>
<Value>UgAwADAAdABQAGEAcwBzAHcAbwByAGQA</Value>
<PlainText>false</PlainText>
</Password>
<Enabled>true</Enabled>
<LogonCount>5</LogonCount>
<Username>Administrator</Username>
</AutoLogon>
<UserAccounts>
<AdministratorPassword>
<Value>UgAwADAAdABBAGQAbQBpAG4AaQBzAHQAcgBhAHQAbwByAFAAYQBzAHMAdwBvAHIAZAA=</Value>
<PlainText>false</PlainText>
</AdministratorPassword>
</UserAccounts>
<FirstLogonCommands>
<SynchronousCommand wcm:action="add">
<Order>1</Order>
<CommandLine>cmd.exe /c powershell.exe set-executionpolicy -ExecutionPolicy RemoteSigned -Force</CommandLine>
<Description>Enable powershell script execution</Description>
</SynchronousCommand>
<SynchronousCommand wcm:action="add">
<Order>2</Order>
<CommandLine>cmd.exe /c bcdedit.exe /set {bootloadersettings} ems on</CommandLine>
<Description>Enable EMS globally in the BootloaderSettings</Description>
</SynchronousCommand>
<SynchronousCommand wcm:action="add">
<Order>3</Order>
<CommandLine>cmd.exe /c powercfg.exe -setacvalueindex scheme_min sub_video videoidle 0</CommandLine>
<Description>Disable monitor timeout to allow iLO CM - set node power off shutdown</Description>
<RequiresUserInput>false</RequiresUserInput>
</SynchronousCommand>
<SynchronousCommand wcm:action="add">
<Order>4</Order>
<CommandLine>cmd.exe /c powercfg.exe -setacvalueindex scheme_max sub_video videoidle 0</CommandLine>
<Description>Disable monitor timeout to allow iLO CM - set node power off shutdown</Description>
<RequiresUserInput>false</RequiresUserInput>
</SynchronousCommand>
<SynchronousCommand wcm:action="add">
<Order>5</Order>
<CommandLine>cmd.exe /c powercfg.exe -setacvalueindex scheme_balanced sub_video videoidle 0</CommandLine>
<Description>Disable monitor timeout to allow iLO CM - set node power off shutdown</Description>
<RequiresUserInput>false</RequiresUserInput>
</SynchronousCommand>
<SynchronousCommand wcm:action="add">
<Order>6</Order>
<CommandLine>cmd.exe /c powercfg.exe -setactive scheme_min</CommandLine>
<Description>Enable High Performance power plan</Description>
<RequiresUserInput>false</RequiresUserInput>
</SynchronousCommand>
<SynchronousCommand wcm:action="add">
<Order>7</Order>
<CommandLine>cmd.exe /c winrm quickconfig -q >C:\out1.txt</CommandLine>
<Description>Setting Remote Permissions</Description>
</SynchronousCommand>
<SynchronousCommand wcm:action="add">
<Order>8</Order>
<CommandLine>cmd.exe /c winrm set winrm/config/service/auth @{Basic="true"} >C:\out2.txt</CommandLine>
<Description>Win RM auth Basic</Description>
</SynchronousCommand>
<SynchronousCommand wcm:action="add">
<Order>9</Order>
<CommandLine>cmd /c winrm set winrm/config/service @{AllowUnencrypted="true"} >C:\out3.txt</CommandLine>
<Description>Enable powershell script execution</Description>
</SynchronousCommand>
<SynchronousCommand wcm:action="add">
<Order>10</Order>
<CommandLine>cmd.exe /c winrm get winrm/config >C:\out4.txt</CommandLine>
<Description>Enable powershell script execution</Description>
</SynchronousCommand>
<SynchronousCommand wcm:action="add">
<Order>11</Order>
<CommandLine>cmd.exe /c powershell.exe Set-NetFirewallRule -DisplayGroup "远程桌面" -Enabled True</CommandLine>
<Description>Enable powershell script execution</Description>
</SynchronousCommand>
<SynchronousCommand wcm:action="add">
<Order>12</Order>
<CommandLine>cmd /c winrm set winrm/config/client @{AllowUnencrypted="true"} >C:\out5.txt</CommandLine>
<Description>Win RM auth Basic</Description>
</SynchronousCommand>
</FirstLogonCommands>
</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>zh-CN</InputLocale>
<SystemLocale>zh-CN</SystemLocale>
<UILanguage>zh-CN</UILanguage>
<UserLocale>zh-CN</UserLocale>
</component>
</settings>
<cpi:offlineImage cpi:source="wim:e:/Images/install-2012r2.wim#Windows Server 2012 R2 SERVERDATACENTER" xmlns:cpi="urn:schemas-microsoft-com:cpi" />
</unattend>