本帖最后由 常先生 于 2021-4-26 20:47 编辑
Windows 10 版本2004及更高版本的操作系统中删除了 Windows To Go。又不想用第三方工具,难免有猫腻,利用PowerShell部署Windows To Go。
Windows PowerShell等效命令部署WindowsTo Go 工作区并在预配期间启用BitLocker
WindowsPowerShell 版权所有 (C)Microsoft Corporation。保留所有权利。 尝试新的跨平台PowerShell https://aka.ms/pscore6 PS C:\Windows\system32> diskpart Microsoft DiskPart 版本 10.0.19041.610 Copyright (C) MicrosoftCorporation. 在计算机上: SURFACE DISKPART> list disk 磁盘 ### 状态 大小 可用 Dyn Gpt -------- ------------- ------- ------- --- --- 磁盘 0 联机 119 GB 0 B * 磁盘 1 联机 115 GB 0 B DISKPART> select disk 1 磁盘 1 现在是所选磁盘。 DISKPART> clean DiskPart 成功地清除了磁盘。 DISKPART> create partitionprimary size=300 DiskPart 成功地创建了指定分区。 DISKPART> format quickfs=fat32 label="System" 100 百分比已完成 DiskPart 成功格式化该卷。 DISKPART> assignletter="S" DiskPart 成功地分配了驱动器号或装载点。 DISKPART> create partitionprimary size=57346 DiskPart 成功地创建了指定分区。 DISKPART> format quickfs=ntfs label="Windows" 100 百分比已完成 DiskPart 成功格式化该卷。 DISKPART> assignletter="W" DiskPart 成功地分配了驱动器号或装载点。 DISKPART> create partitionprimary DiskPart 成功地创建了指定分区。 DISKPART> format quickfs=ntfs label="FileSystem" 100 百分比已完成 DiskPart 成功格式化该卷。 DISKPART> assignletter="R" DiskPart 成功地分配了驱动器号或装载点。 DISKPART> list volume 卷 ### LTR 标签 FS 类型 大小 状态 信息 ---------- --- ----------- ----- ---------- ------- --------- -------- 卷 0 D CPBA_X64FRE UDF DVD-ROM 5793 MB 正常 卷 4 S SYSTEM FAT32 磁盘分区 260 MB 正常 卷 5 W Windows NTFS 磁盘分区 56 GB 正常 * 卷 6 R FileSystem NTFS 磁盘分区 58 GB 正常 DISKPART> exit 退出 DiskPart... PS C:\Windows\system32> set-partition -DriveLetter S -IsActive $TRUE PS C:\Windows\system32> Set-Partition -DriveLetter W -NoDefaultDriveLetter $TRUE PS C:\Windows\system32> Get-WindowsImage -imagepath "D:\sources\install.wim" ImageIndex : 1 ImageName : Windows 10 教育版 ImageDescription : Windows 10 教育版 ImageSize : 16,336,575,424 bytes ImageIndex : 2 ImageName : Windows 10 企业版 ImageDescription : Windows 10 企业版 ImageSize : 16,336,729,419 bytes ImageIndex : 3 ImageName : Windows 10 专业版 ImageDescription : Windows 10 专业版 ImageSize : 16,335,626,987 bytes ImageIndex : 4 ImageName : Windows 10 专业教育版 ImageDescription : Windows 10 专业教育版 ImageSize : 16,336,513,842 bytes ImageIndex : 5 ImageName : Windows 10 专业工作站版 ImageDescription : Windows 10 专业工作站版 ImageSize : 16,336,544,633 bytes PS C:\Windows\system32> dism /apply-image /imagefile:D:\sources\install.wim/index:2 /applydir:W:\ 部署映像服务和管理工具 版本: 10.0.19041.844 正在应用映像 [==========================100.0%==========================] 操作成功完成。 PS C:\Windows\system32> W:\Windows\System32\bcdboot W:\Windows /f ALL /s S: 已成功创建启动文件。 PS C:\Windows\system32> Dism.exe /Image:W:\/Apply-Unattend:W:\san_policy.xml
将san_policy.xml拷贝到主分区根目录下,附件已经提供。
部署映像服务和管理工具 版本: 10.0.19041.844 映像版本: 10.0.19042.867 操作成功完成。
至此,Windows To Go已经部署完成 以下步骤是在预配期间启用BitLocker
PS C:\Windows\system32> $BitlockerRecoveryProtector = Add-BitLockerKeyProtector W: -RecoveryPasswordProtector
警告: 所需操作: 1. 将此数字恢复密码保存在远离你计算机的某个安全位置: 2446 为了防止数据丢失,请立即保存此密码。此密码帮助确保你可以解锁加密的卷。 PS C:\Windows\system32> $RecoveryPassword = $BitlockerRecoveryProtector.KeyProtector.RecoveryPassword PS C:\Windows\system32> $RecoveryPassword >WTG-C_Bitlocker_Recovery_Password.txt [size=14.6667px] 备份恢复密钥在主机Windows\System32下 PS C:\Windows\system32> $spwd = ConvertTo-SecureString-String password -AsplainText –Force 密码自定义 PS C:\Windows\system32> Enable-BitLocker W: -PasswordProtector–UsedSpaceOnly $spwd(仅加密磁盘上的已用空间) Enable-BitLocker W: -PasswordProtector $spwd(加密磁盘上的全部空间) 警告: 所需操作: 1. 将此数字恢复密码保存在远离你计算机的某个安全位置: 2486 为了防止数据丢失,请立即保存此密码。此密码帮助确保你可以解锁加密的卷。 ComputerName:SURFACE VolumeType Mount CapacityGB VolumeStatus Encryption KeyProtector A Point Percentage u ---------- ----- ---------- ------------ ---------- ------------ - Data W: 56.04EncryptionInProgress 82 {RecoveryPassword, Pas... F PSC:\Windows\system32>
|