Skip to content

Instantly share code, notes, and snippets.

@muink
Last active February 6, 2024 07:08
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save muink/72049cb50dabf2249c42eba971484ba9 to your computer and use it in GitHub Desktop.
Save muink/72049cb50dabf2249c42eba971484ba9 to your computer and use it in GitHub Desktop.
简单的WTG部署参考
  1. 分区创建
select volume W
clean
convert mbr
create partition primary size 350
create partition primary
select partition 1
format fs=fat32 quick
active
assign letter=x
select partition 2
format fs=ntfs quick
assign letter=W
attributes volume set nodefaultdriveletter
exit
  1. 部署wim

Dism /Apply-Image /ImageFile:"I:\sources\install.wim" /ApplyDir:W: /Index:1

  1. 部署驱动

dism /image:W: /add-driver /driver:".\Drivers" /recurse /ForceUnsigned

  1. 防止本机磁盘自动联机(保持脱机)

dism /image:W: /Apply-Unattend:".\san_policy.xml"

  1. 禁用WinRE

copy /b /y ".\unattend.xml" W:\Windows\System32\sysprep\

  1. 部署mbr+biod和mbr+uefi引导

bcdboot W:\windows /l zh-CN /s X: /f all
bcdedit /store X:\EFI\Microsoft\Boot\BCD /set {bootmgr} device partition=X:
bcdedit /store X:\EFI\Microsoft\Boot\BCD /set {default} device partition=W:
bcdedit /store X:\EFI\Microsoft\Boot\BCD /set {default} osdevice partition=W:

部署文件

san_policy.xml

<?xml version='1.0' encoding='utf-8' standalone='yes'?>
<unattend xmlns="urn:schemas-microsoft-com:unattend">
  <settings pass="offlineServicing">
    <component
        xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        language="neutral"
        name="Microsoft-Windows-PartitionManager"
        processorArchitecture="x86"
        publicKeyToken="31bf3856ad364e35"
        versionScope="nonSxS"
        >
      <SanPolicy>4</SanPolicy>
    </component>
    <component
        xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        language="neutral"
        name="Microsoft-Windows-PartitionManager"
        processorArchitecture="amd64"
        publicKeyToken="31bf3856ad364e35"
        versionScope="nonSxS"
        >
      <SanPolicy>4</SanPolicy>
    </component>
  </settings>
</unattend>

unattend.xml

<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend">
    <settings pass="oobeSystem">
        <component name="Microsoft-Windows-WinRE-RecoveryAgent"
          processorArchitecture="x86"
          publicKeyToken="31bf3856ad364e35" language="neutral"
          versionScope="nonSxS"
          xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
            <UninstallWindowsRE>true</UninstallWindowsRE>
        </component>
        <component name="Microsoft-Windows-WinRE-RecoveryAgent"
          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">
            <UninstallWindowsRE>true</UninstallWindowsRE>
        </component>
    </settings> 
</unattend>

参考:

WinPE: Storage Area Network (SAN) Policy
Deploy Windows To Go in your organization

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment