首页 > 系统相关 >PowerShell 中使用相关命令管理 FFU(Full Flash Update)映像

PowerShell 中使用相关命令管理 FFU(Full Flash Update)映像

时间:2024-02-04 21:56:19浏览次数:23  
标签:powershellCopy Full FFU Flash 映像 Code path ffu

PowerShell 中使用相关命令管理 FFU(Full Flash Update)映像的示例:

  1. 获取系统中的 Windows 映像信息:

    powershellCopy Code
    Get-WindowsImage
  2. 挂载指定的 Windows 映像:

    powershellCopy Code
    Mount-WindowsImage -ImagePath "C:\path\to\image.ffu" -Index 1 -Path "C:\mount"
  3. 卸载已挂载的 Windows 映像:

    powershellCopy Code
    Dismount-WindowsImage -Path "C:\mount" -Discard
  4. 导出指定的 Windows 映像到其他位置:

    powershellCopy Code
    Export-WindowsImage -SourcePath "C:\path\to\image.ffu" -DestinationPath "D:\exported_image.ffu" -CompressionType None
  5. 删除指定的 Windows 映像:

    powershellCopy Code
    Remove-WindowsImage -ImagePath "C:\path\to\image.ffu"

以上示例中,C:\path\to\image.ffu 是 FFU 映像文件的路径,-Index 参数用于指定映像的索引(如果有多个映像),C:\mount 是用于挂载映像的目标路径,D:\exported_image.ffu 是导出映像的目标路径。


  1. 获取系统中已安装的 Windows 映像:

    powershellCopy Code
    Get-WindowsImage -Online
  2. 挂载指定路径下的 Windows 映像文件,并指定只读权限:

    powershellCopy Code
    Mount-WindowsImage -ImagePath "C:\path\to\image.ffu" -Index 1 -Path "C:\mount" -ReadOnly
  3. 导出指定 Windows 映像文件中的指定映像到其他位置,并使用最快的压缩算法:

    powershellCopy Code
    Export-WindowsImage -SourcePath "C:\path\to\image.ffu" -Index 2 -DestinationPath "D:\exported_image.wim" -CompressionType Max
  4. 删除指定路径下的 Windows 映像文件:

    powershellCopy Code
    Remove-Item "C:\path\to\image.ffu"

处理 FFU 文件需要使用特定的工具和库。Microsoft 提供了 Windows Imaging and Configuration Designer (ICD) 工具,可以用于创建和操作 FFU 映像。您可以使用 ICD 工具的命令行界面(ICD.exe)来执行这些操作。

以下是一些示例用法:

  1. 捕获物理磁盘映像到新的 FFU 文件:

    powershellCopy Code
    ICD.exe /Capture-Ffu /Image "C:\path\to\captured.ffu"
  2. 应用 FFU 映像:

    powershellCopy Code
    ICD.exe /Apply-Ffu /Image "C:\path\to\image.ffu"
  3. 拆分现有的 FFU 文件为多个只读已拆分 FFU 文件:

    powershellCopy Code
    ICD.exe /Split-Ffu /Image "C:\path\to\image.ffu"
  4. 优化 FFU 文件以适应不同大小的存储:

    powershellCopy Code
    ICD.exe /Optimize-Ffu /Image "C:\path\to\image.ffu"

请确保在运行这些命令之前安装和配置了 Windows Imaging and Configuration Designer (ICD) 工具,并将 ICD.exe 添加到系统的 PATH 环境变量中。


PowerShell 命令实现:

  1. 捕获物理磁盘映像到新的 FFU 文件:

    powershellCopy Code
    New-Item -ItemType File "C:\path\to\captured.ffu"
    cmd /c "dism /Capture-Image /ImageFile:""C:\path\to\captured.wim"" /CaptureDrive:""\\"" /Name:""Captured Image"""
    cmd /c "dism /Export-Image /SourceImageFile:""C:\path\to\captured.wim"" /SourceIndex:1 /DestinationImageFile:""C:\path\to\captured.ffu"" /Compress:fast"
    Remove-Item "C:\path\to\captured.wim"
  2. 应用 FFU 映像:

    powershellCopy Code
    cmd /c "dism /Apply-Image /ImageFile:""C:\path\to\image.ffu"" /ApplyDrive:""\\"" /Index:1"
  3. 拆分现有的 FFU 文件为多个只读已拆分 FFU 文件:

    powershellCopy Code
    $chunkSize = 1024*1024*500 # 每个块的大小,以字节为单位(此处设置为500MB)
    $sourceFile = "C:\path\to\image.ffu" # 要拆分的源文件
    $destinationFolder = "C:\path\to\splitted_ffu" # 拆分后的文件存放目录
    $buffer = New-Object byte[] $chunkSize
    $fileStream = New-Object System.IO.FileStream($sourceFile, [System.IO.FileMode]::Open, [System.IO.FileAccess]::Read)
    $counter = 0
    while (($readBytes = $fileStream.Read($buffer, 0, $chunkSize)) -gt 0) {
        $counter++
        $destinationFile = Join-Path $destinationFolder ("part" + "{0:d3}" -f $counter + ".ffu")
        $fs = New-Object System.IO.FileStream($destinationFile, [System.IO.FileMode]::CreateNew, [System.IO.FileAccess]::Write)
        $fs.Write($buffer, 0, $readBytes)
        $fs.Close()
    }
    $fileStream.Close()
  4. 优化 FFU 文件以适应不同大小的存储:

    powershellCopy Code
    cmd /c "dism /Optimize-Image /ImageFile:""C:\path\to\image.ffu"""

在 PowerShell 中,与 FFU 映像相关的命令是使用 Windows 系统映像管理器(DISM)工具来执行的。下面是一些常见的与 FFU 映像相关的 PowerShell 命令:

  1. 捕获物理磁盘映像到新的 FFU 文件:

    powershellCopy Code
    $capturedFile = "C:\path\to\captured.ffu"
    $captureWimFile = "C:\path\to\captured.wim"
    $captureDrive = "C:"
    
    # 使用 DISM 工具捕获物理磁盘映像为 WIM 文件
    dism /Capture-Image /ImageFile:$captureWimFile /CaptureDrive:$captureDrive /Name:"Captured Image"
    
    # 使用 DISM 工具将 WIM 文件导出为 FFU 文件
    dism /Export-Image /SourceImageFile:$captureWimFile /SourceIndex:1 /DestinationImageFile:$capturedFile /Compress:fast
    
    # 删除临时的 WIM 文件
    Remove-Item -Path $captureWimFile
  2. 应用 FFU 映像:

    powershellCopy Code
    $imageFile = "C:\path\to\image.ffu"
    $applyDrive = "C:"
    
    # 使用 DISM 工具将 FFU 映像应用到指定磁盘
    dism /Apply-Image /ImageFile:$imageFile /ApplyDrive:$applyDrive /Index:1
  3. 拆分现有的 FFU 文件为多个只读已拆分 FFU 文件:

    powershellCopy Code
    $sourceFile = "C:\path\to\image.ffu"
    $destinationFolder = "C:\path\to\splitted_ffu"
    $chunkSize = 500MB  # 拆分大小(此处设置为500MB)
    
    # 使用二进制流读取源文件并拆分为多个文件
    $sourceFileStream = [System.IO.File]::OpenRead($sourceFile)
    $buffer = New-Object byte[] $chunkSize
    $counter = 0
    
    while ($sourceFileStream.Position -lt $sourceFileStream.Length) {
        $counter++
        $destinationFile = Join-Path -Path $destinationFolder -ChildPath ("part{0:d3}.ffu" -f $counter)
        $destinationFileStream = [System.IO.File]::Create($destinationFile)
        
        $bytesRead = $sourceFileStream.Read($buffer, 0, $chunkSize)
        $destinationFileStream.Write($buffer, 0, $bytesRead)
        
        $destinationFileStream.Close()
    }
    
    $sourceFileStream.Close()
  4. 优化 FFU 文件以适应不同大小的存储:

    powershellCopy Code
    $imageFile = "C:\path\to\image.ffu"
    
    # 使用 DISM 工具优化 FFU 映像
    dism /Optimize-Image /ImageFile:$imageFile

  1. 检查 FFU 映像的详细信息:

    powershellCopy Code
    $imageFile = "C:\path\to\image.ffu"
    
    # 使用 DISM 工具获取 FFU 映像的详细信息
    dism /Get-ImageInfo /ImageFile:$imageFile
  2. 挂载 FFU 映像为虚拟磁盘:

    powershellCopy Code
    $imageFile = "C:\path\to\image.ffu"
    $mountPath = "D:\mount"
    
    # 使用 DISM 工具将 FFU 映像挂载为虚拟磁盘
    dism /Mount-Image /ImageFile:$imageFile /MountDir:$mountPath
  3. 卸载虚拟磁盘:

    powershellCopy Code
    $mountPath = "D:\mount"
    
    # 使用 DISM 工具卸载指定的虚拟磁盘
    dism /Unmount-Image /MountDir:$mountPath /Discard
  4. 获取已安装映像的列表:

    powershellCopy Code
    # 使用 DISM 工具获取已安装映像的列表
    dism /Get-WimInfo /WimFile:"C:\Windows\system32\Recovery\WindowsRE\Winre.wim"

 

标签:powershellCopy,Full,FFU,Flash,映像,Code,path,ffu
From: https://www.cnblogs.com/suv789/p/18007073

相关文章

  • 10000+AI绘画关键词-涵盖Mid和StableDiffusion
    下载地址:https://pan.quark.cn/s/90634ffdf31910000+AI绘画关键词-涵盖Mid和StableDiffusion......
  • 【AI绘画】最新Stable Diffusion2024年学习——安装与使用教程
    一、安装前准备1、Python官网:www.python.org/downloads/建议安装3.10开头的版本号,下载安装包后运行即可(安装python,建议安装3.10.6版本,这个是StableDiffusionWebUI作者推荐安装版本)安装时将Python添加到默认路径,否则后面很多调用Python进行的操作都会失灵安装完成之后,检查......
  • AI 绘画平台难开发,难变现?试试 Stable Diffusion API Serverless 版解决方案
    AI绘画平台难开发,难变现?试试StableDiffusionAPIServerless版解决方案136人阅读14分钟前分享全屏显示Stable Diffusion 模型,已经成为 AI 行业从传统深度学习时代走向 AIGC 时代的标志性里程碑。越来越多的开发者借助 stable-diffusion-webui (以下简称 SDWeb......
  • 详解module ‘yaml‘ has no attribute ‘FullLoader‘
    详解module'yaml'hasnoattribute'FullLoader'在使用Python中的YAML库进行解析操作时,可能会遇到类似于module'yaml'hasnoattribute'FullLoader'的错误。这个错误通常是由于不同版本的PyYAML库之间的差异导致的。在本篇文章中,我们将详细解释这个问题的原因,并提供一些解决方......
  • AI 绘画平台难开发,难变现?试试 Stable Diffusion API Serverless 版解决方案
    作者:王佳、江昱、筱姜StableDiffusion模型,已经成为AI行业从传统深度学习时代走向AIGC时代的标志性里程碑。越来越多的开发者借助stable-diffusion-webui(以下简称SDWebUI)能力进行AI绘画领域创业或者业务上新,获得高流量及商业价值,但是面对多客户、高并发的复杂场景,使用原......
  • 2024不可不会的StableDiffusion(一)
    1.引言这是我在学习StableDiffusion(稳定扩散模型简称SD)的第一篇入门文章,主要用于介绍稳定扩散模型和该领域的其他研究。在本文中,我想简要介绍一下如何使用Diffuser扩散库,来创建自己生成图像。下一篇文章,我们将深入研究这个库的各级组件。闲话少说,我们直接开始吧!2.SD功能介......
  • Google浏览器Provisional headers are shown. Disable cache to see full headers.
    Google浏览器Provisionalheadersareshown.Disablecachetoseefullheaders.问题解决方法勾选禁用缓存,刷新成功......
  • Stable Diffusion Prompt
    Prompt俗称咒语,实际上也是很难完全把控,在实际生图过程中需要不断的摸索。本文从“规则”、“原理”、“结合扩散模型”三个角度对Prompt进行探讨,希望小伙伴们能对Prompt整体有立体的认识。一、规则1、增强/减弱(emphasized)实质是:缩放语义向量:::warning()强度变为1.1倍[]......
  • Stable Diffusion Seed
    点击了附加/Extra就会看到扩展栏种子变异(Variationseed)变异种子,规则和Seed一致变异强度(Variationstrength)变异种子和原种子的差异强度,为0时为原种子,为1时是新种子(变异种子)。调整变异强度简单正向prompt(1hotgirl),原始种子为1,变异种子为3,不断调整变异强度,得到的图像如下......
  • Python requests连接池超出错误urllib3.connectionpool:Connection pool is full disc
    今天在进行多线程请求的时候出现问题,但是是警告,不过会导致把其他请求给关闭掉,严重影响效率,在网上搜了一大堆都是说urllib3的,没有说requests的。WARNING:urllib3.connectionpool:Connectionpoolisfull,discardingconnection:450632824.shop.n.weimob.com.Connectionpools......