Bat ·

bat一键封装Win2012系统

下面这个cmd命令是运维天涯博主为自己电脑封装系统,大家也可以为自己的服务器制作一个,纯洁,安全,可靠的系统。

@echo off
title=自动安装整合 Win2012 Server R2 数据中心版系统
MODE CON: COLS=76 LINES=50
set tm1=%time:~0,2%
set tm2=%time:~3,2%
set tm3=%time:~6,2%
color 0A
:start
cls
echo.
echo        **********自动安装 Win2012 Server R2 数据中心版 **********
echo.
echo                    现在时间是:%date% %tm1%点%TM2%分%TM3%秒
echo         ╭───────────────────────────╮
echo    ╭─┤        Win2012 Server R2系统高危补丁自动安装程序       ├──╮
echo   │   ╰────────────────────────────╯     │
echo   │   本程序能自动安装  Win2012 Server R2 数据中心版系统高危漏洞补丁   │
echo   │                                                             │
echo   │         制作: 运维天涯  QQ:2016571396   2019年10月1日          │
echo   ╰──────────────────────────────────╯
color 0E
setlocal EnableDelayedExpansion
set a=0
set b=0

REM ################################################################
set DriveU=E:
rem 封装好路径
set setupwim=E:\Win2012R2
set imgjpg=E:\Win2012R2\C_Win2012\Windows\Web\Wallpaper\Windows
rem install.wim解压安装映像路径
set Wim_Dir=C:\Win2012R2\Win2012_R2
rem 补丁路径
set buding=E:\Win2012R2\Hotfix
rem 源sxs路径
set Source_SXS=E:\Win2012R2\Win2012SXS
rem 源install.wim路径
set Source_Dir=D:\install_6052725.wim
rem 导出第4个映像路径
set install_wim=C:\Win2012R2\install2012_6052725.wim
IF NOT EXIST "%Wim_Dir%" (
MD "%Wim_Dir%">nul
)
rem fooher.com 运维天涯一键封装 windows 2012R 系统
rem 获取 功能名称
rem dism /image:E:\Win2012R2\Win2012_R2 /get-features
rem 删除映像
rem IMAGEX /delete d:\system.wim 1
rem dism /delete-image /imagefile:D:install.wim /index:2
rem 显示WIM文件映像信息
DISM /Get-WimInfo /WimFile:%Source_Dir%
pause
echo 导出映像中第4个 数据中心版
rem DISM /Export-Image /SourceImageFile:F:\sources\install.wim /SourceIndex:4 /DestinationImageFile:E:\Win2012R2\install2012.wim
DISM /Export-Image /SourceImageFile:%Source_Dir% /SourceIndex:1 /DestinationImageFile:%install_wim%

echo 01
echo 装载(Mount)映像以可写方式加载install.wim的映像4(即数据中心版映像编号)
echo 到%Wim_Dir%目录(F盘要为NTFS格式),index索引数值 装载 Windows 映像到 %Wim_Dir% 目录
rem dism /mount-image /imageFile:E:\Win2012R2\install2012.wim /index:1 /mountdir:E:\Win2012R2\Win2012_R2
dism /mount-image /imageFile:%install_wim% /index:1 /mountdir:%Wim_Dir%
echo.
pause
echo.
echo 02 设置安装的脱机映像中使用的默认系统用户界面语言
rem dism /image:E:\Win2012R2\Win2012_R2 /Set-UILang:zh-cn
dism /image:%Wim_Dir% /Set-UILang:zh-cn
echo.
echo.
echo 03 区域语言:
rem dism /image:%Wim_Dir% /Set-SysLocale:zh-cn
dism /image:E:\Win2012R2\Win2012_R2 /Set-SysLocale:zh-cn
echo.
echo.
echo 04 用户语言:
rem dism /image:E:\Win2012R2\Win2012_R2 /Set-UserLocale:zh-cn
dism /image:%Wim_Dir% /Set-UserLocale:zh-cn
echo.
echo.
echo 05 默认语言设置为中文区域ID:
dism /image:%Wim_Dir% /set-inputlocale:0804:00000804
Dism /image:%Wim_Dir% /Set-AllIntl:zh-cn
Dism /image:%Wim_Dir% /Set-InputLocale:042d:0000040a
Dism /image:%Wim_Dir% /Set-InputLocale:0411:{03B5835F-F03C-411B-9CE2-AA23E1171E36}{A76C93D9-5523-4E90-AAFA-4DB112F9AC76}
echo.
echo.
echo 06 安装.net 3.5
Dism /Image:%Wim_Dir% /Enable-Feature /All /FeatureName:NetFX3 /Source:%Source_SXS%
Dism /Image:%Wim_Dir% /Enable-Feature /All /FeatureName:NetFx3ServerFeatures /Source:%Source_Dir%
echo.
echo.
echo 07 NET Framework 4.5 功能
Dism /Image:%Wim_Dir% /Enable-Feature /All /FeatureName:NetFX4 /Source:%Source_SXS%
Dism /Image:%Wim_Dir% /Enable-Feature /All /FeatureName:NetFx4ServerFeatures /Source:%Source_SXS%
rem Dism /Image:E:\Win2012R2\Win2012_R2 /Enable-Feature /All /FeatureName:NetFx4ServerFeatures /Source:F:\sources\sxs
echo.
echo.
echo 06 部署在windows 上操作 Net 桌面
echo Microsoft Windows PowerShellISE 依赖必须启用
Dism /Image:%Wim_Dir% /Enable-Feature /All /FeatureName:MicrosoftWindowsPowerShellISE /Source:%Source_SXS%
echo.
echo.
echo 11 无线
Dism /Image:%Wim_Dir% /Enable-Feature /All /FeatureName:Wireless-Networking /Source:%Source_SXS%
echo.
echo.
echo 13 墨迹和手写服务--
Dism /Image:%Wim_Dir% /Enable-Feature /All /FeatureName:InkAndHandwritingServices /Source:%Source_SXS%
echo.
echo.
echo 14 用户界面和基础结构
Dism /Image:%Wim_Dir% /Enable-Feature /All /FeatureName:Server-Gui-Mgmt /Source:%Source_SXS%
echo 09 TCP 端口共享
Dism /Image:%Wim_Dir% /Enable-Feature /All /FeatureName:WCF-TCP-PortSharing45 /Source:%Source_SXS%
rem Dism /Image:E:\Win2012R2\Win2012_R2 /Enable-Feature /All /FeatureName:WCF-TCP-PortSharing45 /Source:F:\sources\sxs
echo.
echo.
echo 10 优质Windows音频视频体验
Dism /Image:%Wim_Dir% /Enable-Feature /All /FeatureName:QWAVE /Source:%Source_SXS%
echo.
echo.
echo 12 telnet 命令
Dism /Image:%Wim_Dir% /Enable-Feature /All /FeatureName:TelnetClient /Source:%Source_SXS%
echo.
echo.
echo 15 桌面体验
Dism /Image:%Wim_Dir% /Enable-Feature /All /FeatureName:DesktopExperience /Source:%Source_SXS%
echo.
echo.
echo 可以关闭窗口
echo 下面是更新补丁,
pause
echo.
echo 说明一下 这里打补丁需要把补丁下载下来,然后在把补丁文件名添加到 fooher.txt 里
echo 一行一个 By 运维天涯_fooher.com
for /f %%i in (fooher.txt) do set /a a+=1
for /f %%j in (foher.txt) do (
set /a b+=1
echo.
echo 正在安装%%j更新(第!b!个更新,共%a%个更新)
Dism /Image:%Wim_Dir% /Add-Package /PackagePath:"%buding%\%%j"
)
echo.
ECHO 卸载并保存已经整合补丁的"install.wim"
echo.
echo 想好还有什么事没有做,所以这里先暂停一下
rem  Dism /Unmount-WIM /MountDir:E:\Win2012R2\Win2012_R2 /Commit
echo.
PAUSE
PAUSE
ECHO 将无人参与文件应用于映像
echo.
DISM /Image:E:\Win2012R2\Win2012_R2 /Apply-Unattend:E:\Win2012R2\unattend.xml
PAUSE
DISM /commit-image /MountDir:%Wim_Dir%
Dism /Unmount-WIM /MountDir:%Wim_Dir% /Commit

REM 打包成ISO镜像
REM oscdimg.exe -m -o -u2 -udfver102 -lHRM_CCSA_X64FRE_ZH-CN_DV5 -bootdata:2#p0,e,bF:\win8x64\boot\etfsboot.com#pEF,e,bF:\win8x64\efi\microsoft\boot\efisys.bin F:\win8x64\ F:\WIN8_X64_201306.ISO -o –m

echo 更新补丁完成,按任意键退出!
pause>nul&exit

 

评论已关闭