VHD_Update_mount-vhd
###################功能说明#####################
###该脚本用来对离线VHD文件更新,导入系统补丁####
################################################
#####################################################实现过程#####################################################
#1.使用Mount-VHD命令挂载VHD文件,该命令包含在Windows Server 2012中,挂载后的盘符无法确定,需要手工指定,如“U:\”#
#2.使用DISM命令将补丁更新(.cab、.msu)导入到VHD文件中,并将日志输出到当前目录下 #
#3.卸载VHD文件 #
##################################################################################################################
$VHD_File = "e:\vhd\test\win2008r2.vhdx"
$Updates_Folder = "E:\vhd\Kb"
#指定盘符
$letter = "U:\"
#DISM命令日志存放于当前脚本目录下
$CurrentPath = $MyInvocation.MyCommand.Path.substring(0,$MyInvocation.MyCommand.Path.LastIndexOf('\')+1)
#$today = Get-Date -UFormat "%Y%m%d"
#$DISM_Log = $CurrentPath+"Result_$today.txt"
#生成添加补丁更新的DISM命令
Function Add_Updates ($Updates_Folder)
{
$Updates = gci $Updates_Folder |? {$_.Extension -eq ".msu" -or $_.Extension -eq ".cab"} |Select Fullname
Foreach ($Update in $Updates)
{
$DISMcmd += "dism /Image:" + $letter + " /Add-Package /PackagePath:" + $Update.Fullname + " /IgnoreCheck" + "`n"
}
Return $DISMcmd
}
#挂载VHD文件,导入补丁更新
Mount-VHD $VHD_File
$Path_Win = Join-Path -Path $letter -ChildPath "Windows"
$Path_ProgramFiles = Join-Path -Path $letter -ChildPath "Program Files"
If ( (Test-Path -Path $Path_Win) -and ( Test-Path -Path $Path_ProgramFiles) )
{
$DISMcmds = Add_Updates $Updates_Folder
$DISMcmds
Invoke-Expression $DISMcmds #|Out-File $DISM_Log -Append
Dismount-VHD $VHD_File
}
Else
{
$ws = New-Object -ComObject WScript.Shell
$ws.popup("VHD盘符不正确,请重新指定!")
}
VHD_Update_mount-vhd的更多相关文章
- Windows Azure Storage (23) 计算Azure VHD实际使用容量
<Windows Azure Platform 系列文章目录> 对于A系列和D系列的虚拟机来说,使用的是普通存储. 普通存储的存储资源,是按照每GB每月计费的.Microsoft Azur ...
- Azure ARM (13) 从现有VHD文件,创建新的ARM VM
<Windows Azure Platform 系列文章目录> 本文参考了Git Hub的ARM Template: https://github.com/Azure/azure-quic ...
- win7挂载VHD文件,模拟多系统并存
挂载vhd是win7 一个很特殊的功能,xp不能支持,一些服务器版的系统 像2008.2008R2这些可能也是支持的,只是没有测试过. 提前的准备: Win7 wim 镜像文件 Imagex.exe ...
- VHDL的参数写在一个vhd文件里
1 参数文件top_pkg.vhd
- Hyper-v虚拟机文件VHDX与VHD的格式转换
今天遇到一个坑,我在本机(windows 10)上创建的CentOS虚拟机作为docker的宿主机,部署了gitlab等容器,准备迁移到服务器上的时候,发现始终无法导入,提示必须通过Hyper-v导出 ...
- [New Portal]Windows Azure Virtual Machine (14) 在本地制作数据文件VHD并上传至Azure(1)
<Windows Azure Platform 系列文章目录> 之前的内容里,我介绍了如何将本地的Server 2012中文版 VHD上传至Windows Azure,并创建基于该Serv ...
- [New Portal]Windows Azure Virtual Machine (15) 在本地制作数据文件VHD并上传至Azure(2)
<Windows Azure Platform 系列文章目录> 在上一章内容里,我们已经将包含有OFFICE2013 ISO安装文件的VHD上传至Azure Blob Storage中了. ...
- Azure 删除VHD时报错:There is currently a lease on the blob and no lease ID was specified in the request
可下载:http://clumsyleaf.com/products/cloudxplorer 然后在Accounts中新建一个Account,账号与Key,可在相应的storage Manage A ...
- 在不格式化原有系统盘的情况下,利用grub4dos+firadisk制作RamOS VHD Win7总结
在不格式化原有系统盘的情况下,利用grub4dos+firadisk制作RamOS VHD Win7总结在不格式化原有系统盘的情况下,用grub4dos+firadisk安装WIN7到VHD,内存大的 ...
- VMWare File Format Learning && Use VHD File To Boot VMWare && CoreOS Docker Configuration And Running
目录 . Virtual Machine Introduce . Vmware Image File Format . VHD File Format . Convert VHD File Into ...
随机推荐
- 【C#学习笔记】播放wav文件
using System; using System.Media; namespace ConsoleApplication { class Program { static void Main(st ...
- RTP协议学习大总结从原理到代码
from:http://wenku.baidu.com/view/aaad3d136edb6f1aff001fa5.html 一.流媒体概念 流媒体包含广义和狭义两种内涵:广义上的流媒体指的是使音频和 ...
- ES PES TS
1.流媒体系统结构 ES:elemental stream 基本数据流: PES:packet elemental stream分组的基本数据流: 然后把PES打包成PS ,TS流,PS:progra ...
- Oracle中获取执行计划的几种方法分析
以下是对Oracle中获取执行计划的几种方法进行了详细的分析介绍,需要的朋友可以参考下 1. 预估执行计划 - Explain PlanExplain plan以SQL语句作为输入,得到这条S ...
- 苹果iphone4s完美越狱后破解4g网络方法
苹果iphone4s完美越狱后破解4g网络方法教程 作者:佚名 字体:[增加 减小] 来源:互联网 时间:01-15 10:07:25我要评论 自从港版iPhone5s/c能够破解移动4G网络后, i ...
- HDU 1247 Hat’s Words
Hat’s Words Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total ...
- [Everyday Mathematics]20150112
设 $f\in C[0,1]$ 适合 $$\bex \int_x^1 f(t)\rd t\geq \frac{1-x^2}{2},\quad \forall\ x\in [0,1]. \eex$$ 试 ...
- Delphi 让自己的软件实现双击打开文件 转
unit shjAssociateFileType; interface uses Windows, Registry; {将文件类型strFileExtension与程序strExeFileName ...
- HTML 表单提交 的简单代码
<form action="check.php" method="post"> 用户名:<input type="text" ...
- cocos2d-x 详解之 CCTexture2D(纹理图片)和 CCTextureCache(纹理缓存)
精灵和动画都涉及到纹理图片的使用,所以在研究精灵与动画之前,我们先来了解一下纹理图片类CCTexture2D和纹理缓存CCTextureCache的原理: 当一张图片被加载到内存后,它是以纹理的形式存 ...