remove GetWAIKTools dependency for BCDEdit and DISM.

Win10 has these tools builtin, use the native binaries instead.
This commit is contained in:
Homes32
2021-11-06 12:38:12 -05:00
parent 29a0352aa2
commit 6e415953e9
6 changed files with 109 additions and 178 deletions

View File

@@ -34,8 +34,8 @@ Description=.NET Framework is a software development framework for building and
Selected=True
Level=4
Author=Homes32
Version=1.2.0.0
Date=2021-07-14
Version=1.3.0.0
Date=2021-10-31
Mandatory=False
[Variables]
@@ -153,9 +153,6 @@ Echo,"Preparing to enable feature: .NET Framework v3..."
StrFormat,PATH,%DismLog%,%DismLogPath%
If,Not,ExistDir,%DismLogPath%,DirMake,%DismLogPath%
If,%HostArch%,Equal,x86,Set,%Dism.exe%,"%Tools%\x86\DISM\dism.exe"
Else,Set,%Dism.exe%,"%Tools%\x64\DISM\dism.exe"
// Make sure our source is Read-Write (ie. not a mounted ISO)
FileCreateBlank,"%SourceDir%\RW-TEST",NOWARN
If,Not,ExistFile,"%SourceDir%\RW-TEST",Begin,
@@ -164,33 +161,23 @@ If,Not,ExistFile,"%SourceDir%\RW-TEST",Begin,
End
FileDelete,"%SourceDir%\RW-TEST"
If,ExistFile,%Dism.exe%,Begin
// Everything is good. let's get to work.
StrFormat,PATH,%Dism.exe%,%Dism.exePath%
// Mount our install.wim image
Echo,"Mounting source image [%SourceInstallWim%]...#$x#$xThis can take awhile, please be patient."
DirMake,%MountDir%
WimMount,%SourceInstallWim%,%SourceInstallWimImage%,%MountDir%,READWRITE
// Mount our install.wim image
Echo,"Mounting source image [%SourceInstallWim%]...#$x#$xThis can take awhile, please be patient."
DirMake,%MountDir%
WimMount,%SourceInstallWim%,%SourceInstallWimImage%,%MountDir%,READWRITE
// Check for .NET 3 and Enable if necessary
Echo,"Enabling feature: .NET Framework 3..."
If,Not,ExistFile,"%MountDir%\Windows\Microsoft.NET\Framework\v2.0.50727\InstallUtil.exe",Begin
ShellExecute,Hide,%Dism.exe%,"/image:#$q%MountDir%#$q /Enable-Feature /FeatureName:NetFx3 /All /LimitAccess /Source:#$q%SourceDir%\sources\sxs#$q /LogPath:#$q%DismLog%#$q",%Dism.exePath%
If,Not,%ExitCode%,Equal,0,Run,%ScriptFile%,AbortFeature
End
Else,Message,".NET Framework 3 is already enabled!",Warning
// Dism doesn't always unload hives correctly. Force unload just to make sure WimUnmout doesn't freak out.
ShellExecute,Hide,%Tools%\x86\HiveUnload.exe,"/HKLM /Target:%TargetSystem32%\config"
Echo,"Committing changes and unmounting source image:#$x [%SourceInstallWim%]...#$x#$xThis can take awhile, please be patient."
WimUnmount,%MountDir%,COMMIT
End
Else,Begin
// Dism.exe is missing. Run Pre-Flight Check to download.
Message,"Error: Dism.exe is missing from the [%Tools%] directory. Please run Pre-Flight Check first to download the required tools.",Warning
Halt,"Error: Dism.exe is missing from the [%Tools%] directory. Please run Pre-Flight Check first to download the required tools."
// Check for .NET 3 and Enable if necessary
Echo,"Enabling feature: .NET Framework 3..."
If,Not,ExistFile,"%MountDir%\Windows\Microsoft.NET\Framework\v2.0.50727\InstallUtil.exe",Begin
ShellExecute,Hide,"Dism.exe","/image:#$q%MountDir%#$q /Enable-Feature /FeatureName:NetFx3 /All /LimitAccess /Source:#$q%SourceDir%\sources\sxs#$q /LogPath:#$q%DismLog%#$q"
If,Not,%ExitCode%,Equal,0,Run,%ScriptFile%,AbortFeature
End
Else,Message,".NET Framework 3 is already enabled!",Warning
// Dism doesn't always unload hives correctly. Force unload just to make sure WimUnmout doesn't freak out.
ShellExecute,Hide,%Tools%\x86\HiveUnload.exe,"/HKLM /Target:%TargetSystem32%\config"
Echo,"Committing changes and unmounting source image:#$x [%SourceInstallWim%]...#$x#$xThis can take awhile, please be patient."
WimUnmount,%MountDir%,COMMIT
[#DisableFx3#]
// ===============================================================================================================================
@@ -210,9 +197,6 @@ Echo,"Preparing to disable feature: .NET Framework v3..."
StrFormat,PATH,%DismLog%,%DismLogPath%
If,Not,ExistDir,%DismLogPath%,DirMake,%DismLogPath%
If,%HostArch%,Equal,x86,Set,%Dism.exe%,"%Tools%\x86\DISM\dism.exe"
Else,Set,%Dism.exe%,"%Tools%\x64\DISM\dism.exe"
// Make sure our source is Read-Write (ie. not a mounted ISO)
FileCreateBlank,"%SourceDir%\RW-TEST",NOWARN
If,Not,ExistFile,"%SourceDir%\RW-TEST",Begin,
@@ -221,33 +205,23 @@ If,Not,ExistFile,"%SourceDir%\RW-TEST",Begin,
End
FileDelete,"%SourceDir%\RW-TEST"
If,ExistFile,%Dism.exe%,Begin
// Everything is good. let's get to work.
StrFormat,PATH,%Dism.exe%,%Dism.exePath%
// Mount our install.wim image
Echo,"Mounting source image [%SourceInstallWim%]...#$x#$xThis can take awhile, please be patient."
DirMake,%MountDir%
WimMount,%SourceInstallWim%,%SourceInstallWimImage%,%MountDir%,READWRITE
// Mount our install.wim image
Echo,"Mounting source image [%SourceInstallWim%]...#$x#$xThis can take awhile, please be patient."
DirMake,%MountDir%
WimMount,%SourceInstallWim%,%SourceInstallWimImage%,%MountDir%,READWRITE
// Check for .NET 3 and Enable if necessary
Echo,"Disabling feature: .NET Framework 3..."
If,ExistFile,"%MountDir%\Windows\Microsoft.NET\Framework\v2.0.50727\InstallUtil.exe",Begin
ShellExecute,Hide,%Dism.exe%,"/image:#$q%MountDir%#$q /Disable-Feature /FeatureName:NetFx3 /LogPath:#$q%DismLog%#$q",%Dism.exePath%
If,Not,%ExitCode%,Equal,0,Run,%ScriptFile%,AbortFeature
End
Else,Message,".NET Framework 3 is already disabled!",Warning
// Dism doesn't always unload hives correctly. Force unload just to make sure WimUnmout doesn't freak out.
ShellExecute,Hide,%Tools%\x86\HiveUnload.exe,"/HKLM /Target:%TargetSystem32%\config"
Echo,"Committing changes and unmounting source image:#$x [%SourceInstallWim%]...#$x#$xThis can take awhile, please be patient."
WimUnmount,%MountDir%,COMMIT
End
Else,Begin
// Dism.exe is missing. Run Pre-Flight Check to download.
Message,"Error: Dism.exe is missing from the [%Tools%] directory. Please run Pre-Flight Check first to download the required tools.",Warning
Halt,"Error: Dism.exe is missing from the [%Tools%] directory. Please run Pre-Flight Check first to download the required tools."
// Check for .NET 3 and Enable if necessary
Echo,"Disabling feature: .NET Framework 3..."
If,ExistFile,"%MountDir%\Windows\Microsoft.NET\Framework\v2.0.50727\InstallUtil.exe",Begin
ShellExecute,Hide,"Dism.exe","/image:#$q%MountDir%#$q /Disable-Feature /FeatureName:NetFx3 /LogPath:#$q%DismLog%#$q"
If,Not,%ExitCode%,Equal,0,Run,%ScriptFile%,AbortFeature
End
Else,Message,".NET Framework 3 is already disabled!",Warning
// Dism doesn't always unload hives correctly. Force unload just to make sure WimUnmout doesn't freak out.
ShellExecute,Hide,%Tools%\x86\HiveUnload.exe,"/HKLM /Target:%TargetSystem32%\config"
Echo,"Committing changes and unmounting source image:#$x [%SourceInstallWim%]...#$x#$xThis can take awhile, please be patient."
WimUnmount,%MountDir%,COMMIT
[#AbortFeature#]
// ===============================================================================================================================

View File

@@ -186,8 +186,6 @@ If,Not,ExistFile,"%Tools%\x86\SetACL.exe",Run,%ScriptFile%,ErrMissingTool,SetACL
If,Not,ExistFile,"%Tools%\x86\xml.exe",Run,%ScriptFile%,ErrMissingTool,xml.exe
// WaikTools
If,Not,ExistFile,"%Tools%\%HostArch%\BCDBoot\bcdedit.exe",Run,%ScriptFile%,GetWaikTools
If,Not,ExistFile,"%Tools%\%HostArch%\DISM\dism.exe",Run,%ScriptFile%,GetWaikTools
If,Not,ExistFile,"%Tools%\%HostArch%\Oscdimg\oscdimg.exe",Run,%ScriptFile%,GetWaikTools
[#ErrMissingTool#]
@@ -208,21 +206,28 @@ Halt,"The build cannot continue because [ #1 ] is missing."
[#GetWaikTools#]
// ===============================================================================================================================
// Name...........: GetWaikTools
// Description....: Download missing/required WAIK tools (dism, oscdimg, etc.) using JFX's GWT.exe
// Description....: Download missing/required WAIK tools (oscdimg, etc.) using JFX's GWT.exe
// Syntax.........:
// Parameters.....:
// Return values..:
// Author.........: Homes32
// Remarks........:
// Remarks........: Note: GetWaikTools has been discontinued as of v21.04. Will need to rewrite this function to use adksetup.exe
// Related........: Called by [CheckTools]
// ===============================================================================================================================
[GetWaikTools]
Echo,"Downloading required tools from Windows 10 ADK...#$x#$xThis will only need to be done once."
ShellExecute,Open,"%Tools%\%HostArch%\GWT.exe","-Win10 -Win10Dism -Silent -folder:%ProjectTemp%"
ShellExecute,Open,"%Tools%\%HostArch%\GWT.exe","-Win10 -Silent -folder:%ProjectTemp%"
DirCopy,"%ProjectTemp%\ADK_6\x86\*.*","%Tools%\x86"
DirCopy,"%ProjectTemp%\ADK_6\amd64\*.*","%Tools%\x64"
If,Not,ExistFile,"%Tools%\x64\Oscdimg\oscdimg.exe",Halt,"Error downloading required Windows 10 ADK tools. The build cannot continue."
// Don't waste disk space with these, we will use the OS versions
DirDeleteEx,"%Tools%\x86\DISM"
DirDeleteEx,"%Tools%\x86\BCDBOOT"
DirDeleteEx,"%Tools%\x64\DISM"
DirDeleteEx,"%Tools%\x64\BCDBOOT"
[#CheckKnownBuilds#]
// ===============================================================================================================================
// Name...........: CheckKnownBuilds

View File

@@ -77,24 +77,13 @@ Echo,"Integrating Drivers...#$x#$xThis can take awhile, please be patient."
StrFormat,PATH,%DismLog%,%DismLogPath%
If,Not,ExistDir,%DismLogPath%,DirMake,%DismLogPath%
If,%HostArch%,Equal,x86,Set,%Dism.exe%,"%Tools%\x86\DISM\dism.exe"
Else,Set,%Dism.exe%,"%Tools%\x64\DISM\dism.exe"
If,%cb_ForceUnsignedDrivers%,Equal,True,Set,%DismForceUnsigned%," /ForceUnsigned"
Else,Set,%DismForceUnsigned%,""
If,ExistFile,%Dism.exe%,Begin
StrFormat,PATH,%Dism.exe%,%Dism.exePath%
ShellExecute,Hide,%Dism.exe%,"/image:#$q%TargetDir%#$q /Add-Driver /Driver:#$q%DriversSrc%#$q /recurse /LogPath:#$q%DismLog%#$q%DismForceUnsigned%",%Dism.exePath%
If,Not,%ExitCode%,Equal,0,Halt,"Error: Dism.exe terminated with error code: [%ExitCode%]. Check the log for details."
// Dism doesn't always unload hives correctly. Force unload just to make sure.
ShellExecute,Hide,%Tools%\x86\HiveUnload.exe,"/HKLM /Target:%TargetSystem32%\config"
End
Else,Begin
// Dism.exe is missing. Run Pre-Flight Check to download.
Message,"Error: Dism.exe is missing from the [%Tools%] directory. Please run Pre-Flight Check first to download the required tools.",Warning
Halt,"Error: Dism.exe is missing from the [%Tools%] directory. Please run Pre-Flight Check first to download the required tools."
End
ShellExecute,Hide,"Dism.exe","/image:#$q%TargetDir%#$q /Add-Driver /Driver:#$q%DriversSrc%#$q /recurse /LogPath:#$q%DismLog%#$q%DismForceUnsigned%"
If,Not,%ExitCode%,Equal,0,Halt,"Error: Dism.exe terminated with error code: [%ExitCode%]. Check the log for details."
// Dism doesn't always unload hives correctly. Force unload just to make sure.
ShellExecute,Hide,%Tools%\x86\HiveUnload.exe,"/HKLM /Target:%TargetSystem32%\config"
[#ExportHostDrivers-ExportHostDrv#]
// ===============================================================================================================================
@@ -148,27 +137,17 @@ System,GetEnv,COMPUTERNAME,%hostname%
Echo,"Exporting Drivers from Host [%hostname%]...#$x#$xThis can take awhile, please be patient."
If,%HostArch%,Equal,x86,Begin
Set,%Dism.exe%,"%Tools%\x86\DISM\dism.exe"
Set,%ExportDest%,"%fb_DriversX86%\Exported-%hostname%"
End
Else,Begin
Set,%Dism.exe%,"%Tools%\x64\DISM\dism.exe"
Set,%ExportDest%,"%fb_DriversX64%\Exported-%hostname%"
End
If,ExistDir,%ExportDest%,DirDeleteEx,%ExportDest%
DirMake,%ExportDest%
If,ExistFile,%Dism.exe%,Begin
// Export Drivers
StrFormat,PATH,%Dism.exe%,%Dism.exePath%
ShellExecute,Hide,%Dism.exe%,"/online /Export-Driver /Destination:#$q%ExportDest%#$q",%Dism.ExePath%
End
Else,Begin
// Dism.exe is missing. Run Pre-Flight Check to download.
Message,"Error: Dism.exe is missing from the [%Tools%] directory. Please run Pre-Flight Check first to download the required tools.",Warning
Halt,"Error: Dism.exe is missing from the [%Tools%] directory. Please run Pre-Flight Check first to download the required tools."
End
// Export Drivers
ShellExecute,Hide,"Dism.exe","/online /Export-Driver /Destination:#$q%ExportDest%#$q"
DirSize,%ExportDest%,%DirSize%
StrFormat,Bytes,%DirSize%,%StrDirSize%

View File

@@ -35,11 +35,10 @@ Author=Homes32
Level=7
Selected=True
Mandatory=True
Version=1.0.1.0
Date=2019-04-18
Version=1.1.0.0
Date=2021-10-31
[Variables]
%bcdedit.exe%="%Tools%\%HostArch%\BCDBoot\bcdedit.exe"
[Process]
Echo,"Preparing to create bootable ISO file..."
@@ -154,33 +153,31 @@ System,EndLocal
[ConfigBcd]
Echo,"Localizing and Configuring Boot Configuration Data..."
StrFormat,PATH,%bcdedit.exe%,%bcdedit.exePath%
///////////////////////////////////////////////////////////////////////////////////
// BIOS
ShellExecute,Hide,%bcdedit.exe%,"/store #$q%OutputDir%\Boot\bcd#$q /set {bootmgr} locale %SourceLang%",%bcdedit.exePath%
ShellExecute,Hide,%bcdedit.exe%,"/store #$q%OutputDir%\Boot\bcd#$q /set {bootmgr} timeout %num_BootMenuDelay%",%bcdedit.exePath%
ShellExecute,Hide,%bcdedit.exe%,"/store #$q%OutputDir%\Boot\bcd#$q /set {bootmgr} displaybootmenu True",%bcdedit.exePath%
ShellExecute,Hide,%bcdedit.exe%,"/store #$q%OutputDir%\Boot\bcd#$q /set {default} locale %SourceLang%",%bcdedit.exePath%
ShellExecute,Hide,%bcdedit.exe%,"/store #$q%OutputDir%\Boot\bcd#$q /set {default} description #$q%ProjectTitle% %SourceArch%#$q",%bcdedit.exePath%
ShellExecute,Hide,%bcdedit.exe%,"/store #$q%OutputDir%\Boot\bcd#$q /set {memdiag} locale %SourceLang%",%bcdedit.exePath%
ShellExecute,Hide,"bcdedit.exe","/store #$q%OutputDir%\Boot\bcd#$q /set {bootmgr} locale %SourceLang%"
ShellExecute,Hide,"bcdedit.exe","/store #$q%OutputDir%\Boot\bcd#$q /set {bootmgr} timeout %num_BootMenuDelay%"
ShellExecute,Hide,"bcdedit.exe","/store #$q%OutputDir%\Boot\bcd#$q /set {bootmgr} displaybootmenu True"
ShellExecute,Hide,"bcdedit.exe","/store #$q%OutputDir%\Boot\bcd#$q /set {default} locale %SourceLang%"
ShellExecute,Hide,"bcdedit.exe","/store #$q%OutputDir%\Boot\bcd#$q /set {default} description #$q%ProjectTitle% %SourceArch%#$q"
ShellExecute,Hide,"bcdedit.exe","/store #$q%OutputDir%\Boot\bcd#$q /set {memdiag} locale %SourceLang%"
// Show progress bar
ShellExecute,Hide,%bcdedit.exe%,"/store #$q%OutputDir%\Boot\bcd#$q /set {default} bootmenupolicy legacy",%bcdedit.exePath%
ShellExecute,Hide,"bcdedit.exe","/store #$q%OutputDir%\Boot\bcd#$q /set {default} bootmenupolicy legacy"
///////////////////////////////////////////////////////////////////////////////////
// UEFI
ShellExecute,Hide,%bcdedit.exe%,"/store #$q%OutputDir%\efi\microsoft\boot\bcd#$q /set {bootmgr} locale %SourceLang%",%bcdedit.exePath%
ShellExecute,Hide,%bcdedit.exe%,"/store #$q%OutputDir%\efi\microsoft\Boot\bcd#$q /set {bootmgr} timeout %num_BootMenuDelay%",%bcdedit.exePath%
ShellExecute,Hide,%bcdedit.exe%,"/store #$q%OutputDir%\efi\microsoft\Boot\bcd#$q /set {bootmgr} displaybootmenu True",%bcdedit.exePath%
ShellExecute,Hide,%bcdedit.exe%,"/store #$q%OutputDir%\efi\microsoft\boot\bcd#$q /set {default} locale %SourceLang%",%bcdedit.exePath%
ShellExecute,Hide,%bcdedit.exe%,"/store #$q%OutputDir%\efi\microsoft\boot\bcd#$q /set {default} description #$q%ProjectTitle% %SourceArch% UEFI#$q",%bcdedit.exePath%
ShellExecute,Hide,%bcdedit.exe%,"/store #$q%OutputDir%\efi\microsoft\boot\bcd#$q /set {memdiag} locale %SourceLang%",%bcdedit.exePath%
ShellExecute,Hide,"bcdedit.exe","/store #$q%OutputDir%\efi\microsoft\boot\bcd#$q /set {bootmgr} locale %SourceLang%"
ShellExecute,Hide,"bcdedit.exe","/store #$q%OutputDir%\efi\microsoft\Boot\bcd#$q /set {bootmgr} timeout %num_BootMenuDelay%"
ShellExecute,Hide,"bcdedit.exe","/store #$q%OutputDir%\efi\microsoft\Boot\bcd#$q /set {bootmgr} displaybootmenu True"
ShellExecute,Hide,"bcdedit.exe","/store #$q%OutputDir%\efi\microsoft\boot\bcd#$q /set {default} locale %SourceLang%"
ShellExecute,Hide,"bcdedit.exe","/store #$q%OutputDir%\efi\microsoft\boot\bcd#$q /set {default} description #$q%ProjectTitle% %SourceArch% UEFI#$q"
ShellExecute,Hide,"bcdedit.exe","/store #$q%OutputDir%\efi\microsoft\boot\bcd#$q /set {memdiag} locale %SourceLang%"
// Show progress bar
ShellExecute,Hide,%bcdedit.exe%,"/store #$q%OutputDir%\efi\microsoft\boot\bcd#$q /set {default} bootmenupolicy legacy",%bcdedit.exePath%
ShellExecute,Hide,"bcdedit.exe","/store #$q%OutputDir%\efi\microsoft\boot\bcd#$q /set {default} bootmenupolicy legacy"
[#BypassDriverSigning#]
// ===============================================================================================================================
@@ -195,9 +192,8 @@ ShellExecute,Hide,%bcdedit.exe%,"/store #$q%OutputDir%\efi\microsoft\boot\bcd#$q
// ===============================================================================================================================
[BypassDriverSigning]
If,%SourceArch%,Equal,x64,Begin
StrFormat,PATH,%bcdedit.exe%,%bcdedit.exePath%
ShellExecute,Hide,%bcdedit.exe%,"/store #$q%OutputDir%\Boot\bcd#$q /set {default} loadoptions DDISABLE_INTEGRITY_CHECKS",%bcdedit.exePath%
ShellExecute,Hide,%bcdedit.exe%,"/store #$q%OutputDir%\efi\microsoft\Boot\bcd#$q /set {default} loadoptions DDISABLE_INTEGRITY_CHECKS",%bcdedit.exePath%
ShellExecute,Hide,"bcdedit.exe","/store #$q%OutputDir%\Boot\bcd#$q /set {default} loadoptions DDISABLE_INTEGRITY_CHECKS"
ShellExecute,Hide,"bcdedit.exe","/store #$q%OutputDir%\efi\microsoft\Boot\bcd#$q /set {default} loadoptions DDISABLE_INTEGRITY_CHECKS"
End
[#SetDefaultOptions#]

View File

@@ -50,50 +50,37 @@ Echo,"Enabling Additional Features..."
StrFormat,PATH,%DismLog%,%DismLogPath%
If,Not,ExistDir,%DismLogPath%,DirMake,%DismLogPath%
If,%HostArch%,Equal,x86,Set,%Dism.exe%,"%Tools%\x86\DISM\dism.exe"
Else,Set,%Dism.exe%,"%Tools%\x64\DISM\dism.exe"
// Make sure our source is Read-Write (ie. not a mounted ISO)
FileCreateBlank,"%SourceDir%\RW-TEST",NOWARN
If,Not,ExistFile,"%SourceDir%\RW-TEST",Halt,"ERROR: You cannot modify features on Read-Only media."
FileDelete,"%SourceDir%\RW-TEST"
If,ExistFile,%Dism.exe%,Begin
// Everything is good. let's get to work.
StrFormat,PATH,%Dism.exe%,%Dism.exePath%
// Mount our install.wim image
Echo,"Mounting source image [%SourceInstallWim%]...#$x#$xThis can take awhile, please be patient."
DirMake,%MountDir%
WimMount,%SourceInstallWim%,%SourceInstallWimImage%,%MountDir%,READWRITE
// Mount our install.wim image
Echo,"Mounting source image [%SourceInstallWim%]...#$x#$xThis can take awhile, please be patient."
DirMake,%MountDir%
WimMount,%SourceInstallWim%,%SourceInstallWimImage%,%MountDir%,READWRITE
Run,%ScriptFile%,ToggleFx3
Run,%ScriptFile%,ToggleFx4
Run,%ScriptFile%,ToggleTelentClient
Run,%ScriptFile%,ToggleTFTP
Run,%ScriptFile%,ToggleLegacyComponents
Run,%ScriptFile%,ToggleLinuxSubsystem
Run,%ScriptFile%,TogglePrintComponents
Run,%ScriptFile%,ToggleFx3
Run,%ScriptFile%,ToggleFx4
Run,%ScriptFile%,ToggleTelentClient
Run,%ScriptFile%,ToggleTFTP
Run,%ScriptFile%,ToggleLegacyComponents
Run,%ScriptFile%,ToggleLinuxSubsystem
Run,%ScriptFile%,TogglePrintComponents
// Dism doesn't always unload hives correctly. Force unload just to make sure WimUnmout doesn't freak out.
ShellExecute,Hide,%Tools%\x86\HiveUnload.exe,"/HKLM /Target:%TargetSystem32%\config"
Echo,"Committing changes and unmounting source image:#$x [%SourceInstallWim%]...#$x#$xThis can take awhile, please be patient."
WimUnmount,%MountDir%,COMMIT
End
Else,Begin
// Dism.exe is missing. Run Pre-Flight Check to download.
Message,"Error: Dism.exe is missing from the [%Tools%] directory. Please run Pre-Flight Check first to download the required tools.",Warning
Halt,"Error: Dism.exe is missing from the [%Tools%] directory. Please run Pre-Flight Check first to download the required tools."
End
// Dism doesn't always unload hives correctly. Force unload just to make sure WimUnmout doesn't freak out.
ShellExecute,Hide,%Tools%\x86\HiveUnload.exe,"/HKLM /Target:%TargetSystem32%\config"
Echo,"Committing changes and unmounting source image:#$x [%SourceInstallWim%]...#$x#$xThis can take awhile, please be patient."
WimUnmount,%MountDir%,COMMIT
[ToggleSMB1]
If,%cb_SMBv1%,Equal,True,Begin
Echo,"Enabling feature: Server Message Block v1..."
If,Not,ExistFile,"%MountDir%\Windows\System32\drivers\mrxsmb10.sys",Begin
ShellExecute,Hide,%Dism.exe%,"/image:#$q%MountDir%#$q /Enable-Feature /FeatureName:SMB1Protocol /All /LimitAccess /Source:#$q%SourceDir%\Sources\sxs#$q /LogPath:#$q%DismLog%#$q",%Dism.exePath%
ShellExecute,Hide,%Dism.exe%,"/image:#$q%MountDir%#$q /Enable-Feature /FeatureName:SMB1Protocol-Client /All /LimitAccess /Source:#$q%SourceDir%\Sources\sxs#$q /LogPath:#$q%DismLog%#$q",%Dism.exePath%
ShellExecute,Hide,%Dism.exe%,"/image:#$q%MountDir%#$q /Enable-Feature /FeatureName:SMB1Protocol-Server /All /LimitAccess /Source:#$q%SourceDir%\Sources\sxs#$q /LogPath:#$q%DismLog%#$q",%Dism.exePath%
ShellExecute,Hide,%Dism.exe%,"/image:#$q%MountDir%#$q /Enable-Feature /FeatureName:SMB1Protocol-Deprecation /All /LimitAccess /Source:#$q%SourceDir%\Sources\sxs#$q /LogPath:#$q%DismLog%#$q",%Dism.exePath%
ShellExecute,Hide,"Dism.exe","/image:#$q%MountDir%#$q /Enable-Feature /FeatureName:SMB1Protocol /All /LimitAccess /Source:#$q%SourceDir%\Sources\sxs#$q /LogPath:#$q%DismLog%#$q"
ShellExecute,Hide,"Dism.exe","/image:#$q%MountDir%#$q /Enable-Feature /FeatureName:SMB1Protocol-Client /All /LimitAccess /Source:#$q%SourceDir%\Sources\sxs#$q /LogPath:#$q%DismLog%#$q"
ShellExecute,Hide,"Dism.exe","/image:#$q%MountDir%#$q /Enable-Feature /FeatureName:SMB1Protocol-Server /All /LimitAccess /Source:#$q%SourceDir%\Sources\sxs#$q /LogPath:#$q%DismLog%#$q"
ShellExecute,Hide,"Dism.exe","/image:#$q%MountDir%#$q /Enable-Feature /FeatureName:SMB1Protocol-Deprecation /All /LimitAccess /Source:#$q%SourceDir%\Sources\sxs#$q /LogPath:#$q%DismLog%#$q"
If,Not,%ExitCode%,Equal,0,Run,%ScriptFile%,Abort
End
Else,Echo,"Server Message Block v1 is already enabled!"
@@ -101,10 +88,10 @@ End
Else,Begin
Echo,"Disabling feature: Server Message Block v1..."
If,ExistFile,"%MountDir%\Windows\System32\drivers\mrxsmb10.sys",Begin
ShellExecute,Hide,%Dism.exe%,"/image:#$q%MountDir%#$q /Disable-Feature /FeatureName:SMB1Protocol /LogPath:#$q%DismLog%#$q",%Dism.exePath%
ShellExecute,Hide,%Dism.exe%,"/image:#$q%MountDir%#$q /Disable-Feature /FeatureName:SMB1Protocol-Client /LogPath:#$q%DismLog%#$q",%Dism.exePath%
ShellExecute,Hide,%Dism.exe%,"/image:#$q%MountDir%#$q /Disable-Feature /FeatureName:SMB1Protocol-Server /LogPath:#$q%DismLog%#$q",%Dism.exePath%
ShellExecute,Hide,%Dism.exe%,"/image:#$q%MountDir%#$q /Disable-Feature /FeatureName:SMB1Protocol-Deprecation /LogPath:#$q%DismLog%#$q",%Dism.exePath%
ShellExecute,Hide,"Dism.exe","/image:#$q%MountDir%#$q /Disable-Feature /FeatureName:SMB1Protocol /LogPath:#$q%DismLog%#$q"
ShellExecute,Hide,"Dism.exe","/image:#$q%MountDir%#$q /Disable-Feature /FeatureName:SMB1Protocol-Client /LogPath:#$q%DismLog%#$q"
ShellExecute,Hide,"Dism.exe","/image:#$q%MountDir%#$q /Disable-Feature /FeatureName:SMB1Protocol-Server /LogPath:#$q%DismLog%#$q"
ShellExecute,Hide,"Dism.exe","/image:#$q%MountDir%#$q /Disable-Feature /FeatureName:SMB1Protocol-Deprecation /LogPath:#$q%DismLog%#$q"
If,Not,%ExitCode%,Equal,0,Run,%ScriptFile%,Abort
End
Else,Echo,"Server Message Block v1 is already disabled!"
@@ -114,7 +101,7 @@ End
If,%cb_NetFX3%,Equal,True,Begin
Echo,"Enabling feature: .NET Framework 3..."
If,Not,ExistFile,"%MountDir%\Windows\Microsoft.NET\Framework\v2.0.50727\InstallUtil.exe",Begin
ShellExecute,Hide,%Dism.exe%,"/image:#$q%MountDir%#$q /Enable-Feature /FeatureName:NetFx3 /All /LimitAccess /Source:#$q%SourceDir%\Sources\sxs#$q /LogPath:#$q%DismLog%#$q",%Dism.exePath%
ShellExecute,Hide,"Dism.exe","/image:#$q%MountDir%#$q /Enable-Feature /FeatureName:NetFx3 /All /LimitAccess /Source:#$q%SourceDir%\Sources\sxs#$q /LogPath:#$q%DismLog%#$q"
If,Not,%ExitCode%,Equal,0,Run,%ScriptFile%,Abort
End
Else,Echo,".NET Framework 3 is already enabled!"
@@ -122,7 +109,7 @@ End
Else,Begin
Echo,"Disabling feature: .NET Framework 3..."
If,ExistFile,"%MountDir%\Windows\Microsoft.NET\Framework\v2.0.50727\InstallUtil.exe",Begin
ShellExecute,Hide,%Dism.exe%,"/image:#$q%MountDir%#$q /Disable-Feature /FeatureName:NetFx3 /LogPath:#$q%DismLog%#$q",%Dism.exePath%
ShellExecute,Hide,"Dism.exe","/image:#$q%MountDir%#$q /Disable-Feature /FeatureName:NetFx3 /LogPath:#$q%DismLog%#$q"
If,Not,%ExitCode%,Equal,0,Run,%ScriptFile%,Abort
End
Else,Echo,".NET Framework 3 is already disabled!"
@@ -132,7 +119,7 @@ End
If,%cb_NetFX4%,Equal,True,Begin
Echo,"Enabling feature: .NET Framework 4 Extended..."
If,Not,ExistDir,"%MountDir%\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files",Begin
ShellExecute,Hide,%Dism.exe%,"/image:#$q%MountDir%#$q /Enable-Feature /FeatureName:NetFx4Extended-ASPNET45 /All /LimitAccess /Source:#$q%SourceDir%\Sources\sxs#$q /LogPath:#$q%DismLog%#$q",%Dism.exePath%
ShellExecute,Hide,"Dism.exe","/image:#$q%MountDir%#$q /Enable-Feature /FeatureName:NetFx4Extended-ASPNET45 /All /LimitAccess /Source:#$q%SourceDir%\Sources\sxs#$q /LogPath:#$q%DismLog%#$q"
If,Not,%ExitCode%,Equal,0,Run,%ScriptFile%,Abort
End
Else,Echo,".NET Framework 4 Extended is already enabled!"
@@ -140,7 +127,7 @@ End
Else,Begin
Echo,"Disabling feature: .NET Framework 4 Extended..."
If,ExistDir,"%MountDir%\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files",Begin
ShellExecute,Hide,%Dism.exe%,"/image:#$q%MountDir%#$q /Disable-Feature /FeatureName:NetFx4Extended-ASPNET45 /LogPath:#$q%DismLog%#$q",%Dism.exePath%
ShellExecute,Hide,"Dism.exe","/image:#$q%MountDir%#$q /Disable-Feature /FeatureName:NetFx4Extended-ASPNET45 /LogPath:#$q%DismLog%#$q"
If,Not,%ExitCode%,Equal,0,Run,%ScriptFile%,Abort
End
Else,Echo,".NET Framework 4 Extended is already disabled!"
@@ -150,7 +137,7 @@ End
If,%cb_TelentClient%,Equal,True,Begin
Echo,"Enabling feature: Telnet Client..."
If,Not,ExistFile,"%MountDir%\Windows\System32\telnet.exe",Begin
ShellExecute,Hide,%Dism.exe%,"/image:#$q%MountDir%#$q /Enable-Feature /FeatureName:TelnetClient /All /LimitAccess /Source:#$q%SourceDir%\Sources\sxs#$q /LogPath:#$q%DismLog%#$q",%Dism.exePath%
ShellExecute,Hide,"Dism.exe","/image:#$q%MountDir%#$q /Enable-Feature /FeatureName:TelnetClient /All /LimitAccess /Source:#$q%SourceDir%\Sources\sxs#$q /LogPath:#$q%DismLog%#$q"
If,Not,%ExitCode%,Equal,0,Run,%ScriptFile%,Abort
End
Else,Echo,"Telnet Client is already enabled!"
@@ -158,7 +145,7 @@ End
Else,Begin
Echo,"Disabling feature: Telnet Client..."
If,ExistFile,"%MountDir%\Windows\System32\telnet.exe",Begin
ShellExecute,Hide,%Dism.exe%,"/image:#$q%MountDir%#$q /Disable-Feature /FeatureName:TelnetClient /LogPath:#$q%DismLog%#$q",%Dism.exePath%
ShellExecute,Hide,"Dism.exe","/image:#$q%MountDir%#$q /Disable-Feature /FeatureName:TelnetClient /LogPath:#$q%DismLog%#$q"
If,Not,%ExitCode%,Equal,0,Run,%ScriptFile%,Abort
End
Else,Echo,"Telnet Client is already disabled!"
@@ -168,7 +155,7 @@ End
If,%cb_TFTP%,Equal,True,Begin
Echo,"Enabling feature: TFTP..."
If,Not,ExistFile,"%MountDir%\Windows\System32\tftp.exe",Begin
ShellExecute,Hide,%Dism.exe%,"/image:#$q%MountDir%#$q /Enable-Feature /FeatureName:TFTP /All /LimitAccess /Source:#$q%SourceDir%\Sources\sxs#$q /LogPath:#$q%DismLog%#$q",%Dism.exePath%
ShellExecute,Hide,"Dism.exe","/image:#$q%MountDir%#$q /Enable-Feature /FeatureName:TFTP /All /LimitAccess /Source:#$q%SourceDir%\Sources\sxs#$q /LogPath:#$q%DismLog%#$q"
If,Not,%ExitCode%,Equal,0,Run,%ScriptFile%,Abort
End
Else,Echo,"TFTP is already enabled!"
@@ -176,7 +163,7 @@ End
Else,Begin
Echo,"Disabling feature: TFTP Client..."
If,ExistFile,"%MountDir%\Windows\System32\tftp.exe",Begin
ShellExecute,Hide,%Dism.exe%,"/image:#$q%MountDir%#$q /Disable-Feature /FeatureName:TFTP /LogPath:#$q%DismLog%#$q",%Dism.exePath%
ShellExecute,Hide,"Dism.exe","/image:#$q%MountDir%#$q /Disable-Feature /FeatureName:TFTP /LogPath:#$q%DismLog%#$q"
If,Not,%ExitCode%,Equal,0,Run,%ScriptFile%,Abort
End
Else,Echo,"TFTP Client is already disabled!"
@@ -186,7 +173,7 @@ End
If,%cb_Linux%,Equal,True,Begin
Echo,"Enabling feature: Legacy Components (DirectPlay)..."
If,Not,ExistFile,"%MountDir%\Windows\System32\bash.exe",Begin
ShellExecute,Hide,%Dism.exe%,"/image:#$q%MountDir%#$q /Enable-Feature /FeatureName:LegacyComponents /All /LimitAccess /Source:#$q%SourceDir%\Sources\sxs#$q /LogPath:#$q%DismLog%#$q",%Dism.exePath%
ShellExecute,Hide,"Dism.exe","/image:#$q%MountDir%#$q /Enable-Feature /FeatureName:LegacyComponents /All /LimitAccess /Source:#$q%SourceDir%\Sources\sxs#$q /LogPath:#$q%DismLog%#$q"
If,Not,%ExitCode%,Equal,0,Run,%ScriptFile%,Abort
End
Else,Echo,"Legacy Components (DirectPlay) are already enabled!"
@@ -194,7 +181,7 @@ End
Else,Begin
Echo,"Disabling feature: Legacy Components (DirectPlay)..."
If,ExistFile,"%MountDir%\Windows\System32\bash.exe",Begin
ShellExecute,Hide,%Dism.exe%,"/image:#$q%MountDir%#$q /Disable-Feature /FeatureName:LegacyComponents /LogPath:#$q%DismLog%#$q",%Dism.exePath%
ShellExecute,Hide,"Dism.exe","/image:#$q%MountDir%#$q /Disable-Feature /FeatureName:LegacyComponents /LogPath:#$q%DismLog%#$q"
If,Not,%ExitCode%,Equal,0,Run,%ScriptFile%,Abort
End
Else,Echo,"Legacy Components (DirectPlay) is already disabled!"
@@ -204,7 +191,7 @@ End
If,%cb_Linux%,Equal,True,Begin
Echo,"Enabling feature: Linux Subsystem..."
If,Not,ExistFile,"%MountDir%\Windows\System32\bash.exe",Begin
ShellExecute,Hide,%Dism.exe%,"/image:#$q%MountDir%#$q /Enable-Feature /FeatureName:Microsoft-Windows-Subsystem-Linux /All /LimitAccess /Source:#$q%SourceDir%\Sources\sxs#$q /LogPath:#$q%DismLog%#$q",%Dism.exePath%
ShellExecute,Hide,"Dism.exe","/image:#$q%MountDir%#$q /Enable-Feature /FeatureName:Microsoft-Windows-Subsystem-Linux /All /LimitAccess /Source:#$q%SourceDir%\Sources\sxs#$q /LogPath:#$q%DismLog%#$q"
If,Not,%ExitCode%,Equal,0,Run,%ScriptFile%,Abort
End
Else,Echo,"Linux Subsystem is already enabled!"
@@ -212,7 +199,7 @@ End
Else,Begin
Echo,"Disabling feature: Linux Subsystem..."
If,ExistFile,"%MountDir%\Windows\System32\bask.exe",Begin
ShellExecute,Hide,%Dism.exe%,"/image:#$q%MountDir%#$q /Disable-Feature /FeatureName:Microsoft-Windows-Subsystem-Linux /LogPath:#$q%DismLog%#$q",%Dism.exePath%
ShellExecute,Hide,"Dism.exe","/image:#$q%MountDir%#$q /Disable-Feature /FeatureName:Microsoft-Windows-Subsystem-Linux /LogPath:#$q%DismLog%#$q"
If,Not,%ExitCode%,Equal,0,Run,%ScriptFile%,Abort
End
Else,Echo,"Linux Subsystem is already disabled!"
@@ -222,8 +209,8 @@ End
If,%cb_Print%,Equal,True,Begin
Echo,"Enabling feature: Print Components..."
If,Not,ExistFile,"%MountDir%\Windows\System32\lpdsvc.dll",Begin
ShellExecute,Hide,%Dism.exe%,"/image:#$q%MountDir%#$q /Enable-Feature /FeatureName:Printing-Foundation-LPDPrintService /All /LimitAccess /Source:#$q%SourceDir%\Sources\sxs#$q /LogPath:#$q%DismLog%#$q",%Dism.exePath%
ShellExecute,Hide,%Dism.exe%,"/image:#$q%MountDir%#$q /Enable-Feature /FeatureName:Printing-Foundation-LPRPortMonitor /All /LimitAccess /Source:#$q%SourceDir%\Sources\sxs#$q /LogPath:#$q%DismLog%#$q",%Dism.exePath%
ShellExecute,Hide,"Dism.exe","/image:#$q%MountDir%#$q /Enable-Feature /FeatureName:Printing-Foundation-LPDPrintService /All /LimitAccess /Source:#$q%SourceDir%\Sources\sxs#$q /LogPath:#$q%DismLog%#$q"
ShellExecute,Hide,"Dism.exe","/image:#$q%MountDir%#$q /Enable-Feature /FeatureName:Printing-Foundation-LPRPortMonitor /All /LimitAccess /Source:#$q%SourceDir%\Sources\sxs#$q /LogPath:#$q%DismLog%#$q"
If,Not,%ExitCode%,Equal,0,Run,%ScriptFile%,Abort
End
Else,Echo,"Print Components are already installed!"
@@ -231,8 +218,8 @@ End
Else,Begin
Echo,"Disabling feature: Print Components..."
If,ExistFile,"%MountDir%\Windows\System32\lpdsvc.dll",Begin
ShellExecute,Hide,%Dism.exe%,"/image:#$q%MountDir%#$q /Disable-Feature /FeatureName:Printing-Foundation-LPDPrintService /LogPath:#$q%DismLog%#$q",%Dism.exePath%
ShellExecute,Hide,%Dism.exe%,"/image:#$q%MountDir%#$q /Disable-Feature /FeatureName:Printing-Foundation-LPRPortMonitor /LogPath:#$q%DismLog%#$q",%Dism.exePath%
ShellExecute,Hide,"Dism.exe","/image:#$q%MountDir%#$q /Disable-Feature /FeatureName:Printing-Foundation-LPDPrintService /LogPath:#$q%DismLog%#$q"
ShellExecute,Hide,"Dism.exe","/image:#$q%MountDir%#$q /Disable-Feature /FeatureName:Printing-Foundation-LPRPortMonitor /LogPath:#$q%DismLog%#$q"
If,Not,%ExitCode%,Equal,0,Run,%ScriptFile%,Abort
End
Else,Echo,"Print Components are already disabled!"

View File

@@ -40,8 +40,8 @@ Author=Homes32
Level=4
Selected=True
Mandatory=False
Version=1.2.0.0
Date=2019-05-03
Version=1.3.0.0
Date=2021-10-31
[Variables]
%DismLog%="%TargetWindows%\Logs\DISM\dism.log"
@@ -84,16 +84,6 @@ StrFormat,CTRIM,%TimeZone%," ",%TimeZone%
StrFormat,PATH,%DismLog%,%DismLogPath%
If,Not,ExistDir,%DismLogPath%,DirMake,%DismLogPath%
If,%HostArch%,Equal,x86,Set,%Dism.exe%,"%Tools%\x86\DISM\dism.exe"
Else,Set,%Dism.exe%,"%Tools%\x64\DISM\dism.exe"
If,Not,ExistFile,%Dism.exe%,Begin
// Dism.exe is missing. Prompt the user to run Pre-Flight Check to download.
Message,"Error: Dism.exe is missing from the [%Tools%] directory. Please run Pre-Flight Check first to download the required tools.",Warning
Halt,"Error: Dism.exe is missing from the [%Tools%] directory. Please run Pre-Flight Check first to download the required tools."
End
Else,StrFormat,PATH,%Dism.exe%,%Dism.exePath%
// Get HostOS Settings if needed
If,%cmb_InputLocale1%,Equal,HostOS,Run,%ScriptFile%,GetHostInternationalSettings
Else,If,%cmb_InputLocale2%,Equal,HostOS,Run,%ScriptFile%,GetHostInternationalSettings
@@ -125,7 +115,7 @@ If,%cb_PinToStartMenu%,Equal,True,PinShortcut,StartMenu,Auto,"%WinDir%\System32\
// ===============================================================================================================================
[GetHostInternationalSettings]
Echo,"Retrieving Host International Settings...#$x#$xThis can take awhile, please be patient."
ShellExecute,Hide,"cmd.exe","/D /C %Dism.exe% /online /Get-Intl /English /LogPath:#$q%DismLog%#$q > #$q%ProjectTemp%\Get-Intl.ini#$q",%Dism.exePath%
ShellExecute,Hide,"cmd.exe","/D /C dism.exe /online /Get-Intl /English /LogPath:#$q%DismLog%#$q > #$q%ProjectTemp%\Get-Intl.ini#$q"
If,Not,%ExitCode%,Equal,0,Halt,"Error: Dism.exe terminated with error code: [%ExitCode%]. Check the log for details."
If,ExistFile,"%ProjectTemp%\Get-Intl.ini",Begin
@@ -174,7 +164,7 @@ If,Not,%TimeZone%,Equal,Default,Set,%DismArg%,"%DismArg% /Set-TimeZone:#$q%TimeZ
// Set Keyboard, Format and Timezone with DISM
If,Not,%DismArg%,Equal,"",Begin
Echo,"Configuring International Settings...#$x#$xThis can take awhile, please be patient."
ShellExecute,Hide,%Dism.exe%,"/image:#$q%TargetDir%#$q %DismArg% /LogPath:#$q%DismLog%#$q",%Dism.exePath%
ShellExecute,Hide,"dism.exe","/image:#$q%TargetDir%#$q %DismArg% /LogPath:#$q%DismLog%#$q"
If,Not,%ExitCode%,Equal,0,Halt,"Error: Dism.exe terminated with error code: [%ExitCode%]. Check the log for details."
End