@MSMG @bou7a Here is a PS script i wrote after reading posts from stackoverflow and msdn Code: $input_values = Get-ChildItem -Path "*.reg" foreach ($file in $input_values) { [System.Collections.ArrayList]$content = Get-content -Path $file | Where { $_ -notmatch "^(\s+)?;|^\s*$" } [hashtable]$equivalents = @{ "HKEY_LOCAL_MACHINE\SOFTWARE" = "HKEY_LOCAL_MACHINE\TK_SOFTWARE"; "HKEY_CLASSES_ROOT" = "HKEY_LOCAL_MACHINE\TK_SOFTWARE\Classes"; "HKEY_LOCAL_MACHINE\SYSTEM" = "HKEY_LOCAL_MACHINE\TK_SYSTEM"; "HKEY_CURRENT_USER" = "HKEY_LOCAL_MACHINE\TK_NTUSER"; "HKEY_USERS\.Default" = "HKEY_LOCAL_MACHINE\TK_DEFAULT"} [string]$output = "" [string]$newline = "" foreach($line in $content) { if ($line -match "^\[.*\]$") { foreach($key in $equivalents.Keys) { if ($line.Contains($key)) { $newline = $line.Replace($key, $equivalents[$key]) break } } } else { $newline = $line } $output += $newline + "`n" } $filename = [System.IO.Path]::GetFileName($file) $path = [System.IO.Path]::GetDirectoryName($file) Set-Content -Path ($path + "\converted_" + $filename) -Value $output This reads all .reg files in same folder as this script and converts the keys, then writes back to disk with "converted_" string prepended to filename. No safety checks are present, so be careful. It is intended to work with toolkit as per MSMG's suggestion about manually mounting registry during toolkit operation.
Good morning. I ask if this procedure is right for entering registry keys to perform many tweaks that I perform manually, after installation. Thank you
With this script one can "expand" number of tweaks that toolkit can do, but i urge anyone using it to be CAREFUL. As is already known messing with registry can lead to OS not booting or working badly/unsafe, and in case of altering installation disk bad registry can cause install to fail, or worse, OS to fail after install during "normal" operation. So above all, check ALL registry files, check all keys BEFORE and AFTER processing them with this script. You have been warned.
Yes updating change-log, documentation, Hashes and also cleaning up the Toolkit script and packs folder, It will be out in this week. No I haven't checked the Component removal with VirtualBox.
This is mainly for offline image, for online you don't need to rename the reg root key names, just use a NSudo command prompt and import the registry files.
It's better to use [HEY_ or [-HKEY_ while renaming since many windows reg keys have HKEY_ as subkey names in between. Code: [hashtable]$equivalents = @{ "[HKEY_LOCAL_MACHINE\SOFTWARE" = "[HKEY_LOCAL_MACHINE\TK_SOFTWARE"; "[-HKEY_LOCAL_MACHINE\SOFTWARE" = "[-HKEY_LOCAL_MACHINE\TK_SOFTWARE"; "[HKEY_CLASSES_ROOT" = "[HKEY_LOCAL_MACHINE\TK_SOFTWARE\Classes"; "[-HKEY_CLASSES_ROOT" = "[-HKEY_LOCAL_MACHINE\TK_SOFTWARE\Classes"; "[HKEY_LOCAL_MACHINE\SYSTEM" = "[HKEY_LOCAL_MACHINE\TK_SYSTEM"; "[-HKEY_LOCAL_MACHINE\SYSTEM" = "[-HKEY_LOCAL_MACHINE\TK_SYSTEM"; "[HKEY_CURRENT_USER" = "[HKEY_LOCAL_MACHINE\TK_NTUSER"; "[-HKEY_CURRENT_USER" = "[-HKEY_LOCAL_MACHINE\TK_NTUSER"; "[HKEY_USERS\.Default" = "[HKEY_LOCAL_MACHINE\TK_DEFAULT"} "[-HKEY_USERS\.Default" = "[-HKEY_LOCAL_MACHINE\TK_DEFAULT"}
hi there, i'm so sorry if this question has been asked before, but would it be possable to have paralelle processes performed at one time? e.g when adding drivers they are added one at a time currently but if it was possible to have more than one driver/removal process performed at the same time, it would speed things up specially on multi core systems like mine is, sorry if it's been asked allready, maybe a switch could be added? thanks for reading my question, i'm visually impared and if there are spelling errors i am sorry about them.
DOS Batch scripting runs step by step and Toolkit just calls the DISM.exe to perform all image related operations except component removal. The Toolkit does not have control over how the DISM.exe will process the operation, may be in DISM API there might be option to run parallel tasks.
parallelism will be out with Windows 20 Windows is quite inefficient with current hardware so i wouldn't expect thier supporting software like dsim to be efficient.
Will it be compatible with 19H2? Will WU restore removed components after installing updates and regardless of that will we be able to install more recent updates after the previous ones?
Since I don't know the procedure well with ToolKit, I insert registry tweak and software using the RunOnce Ex procedure. The RunOnceEx procedure installs tweaks and software only when the user is created and not for all users. My question is whether I can use a dedicated ToolKit section for this purpose. Thank you very much
One of the reasons I have to run my post install script manually, is that I have to change drive letters before the script is run because there are several drives on each of the systems, And Windows windows never seems to allocate them the same way twice. With PCs sharing data the drive letters need to be consistent across each PC. With that in mind, does any one know a way that I can change the drive letters from batch (Not with Diskpart)? Then I can integrate my script into my MSMG image EDIT: Optical drives need to be re-assigned to and get-disk in powershell does not report optical drives.
No not tested with 19H2 yet, Yes WU is working but it restores the removed components, Need to test WU with previous updates been already installed. Let me release a version, Will further tweak the component removal to fix any issues occurring.
Did you tried just the RunOnce procedure or else you can use the INF method to commands before the user creation like the one used in .NET FX 4.7 Pack for Windows 7. Will try to add an option in Toolkit to import tweaks from registry file.
Instead of changing the drive letter, why don't you get the drive letter containing your script and assign it in your script. Here's the command to get Optical driver letter in PowerShell Code: Get-CimInstance Win32_LogicalDisk | ?{ $_.DriveType -eq 5} | select DeviceID Changing the Optical driver letter in PowerShell Code: # Set CD/DVD Drive to A: $cd = $NULL $cd = Get-WMIObject -Class Win32_CDROMDrive -ComputerName $env:COMPUTERNAME -ErrorAction Stop if ($cd.Drive -eq "D:") { Write-Output "Changing CD Drive letter from D: to A:" Set-WmiInstance -InputObject ( Get-WmiObject -Class Win32_volume -Filter "DriveLetter = 'd:'" ) -Arguments @{DriveLetter='a:'} } or Code: # Set CD/DVD Drive to A: Get-WmiObject -Class Win32_volume -Filter 'DriveType=5' | Select-Object -First 1 | Set-WmiInstance -Arguments @{DriveLetter='A:'}
Could you check if after removing (or not) the restored components (if you find a way to remove them [or even better, prevent them from being reinstalled after installing an update via WU]) you can install a following CU (a second one, so)?
Because I always use A: and B: for optical drives. I have 7 disk partitions and mapped network drives that go from M: to Y:, leaving me only 2 drive letters for removable drives. I want to have the same drive letters on each PC for the same purpose. Eg. D:\ is used for Steam, Origin and Battle.net (Always SSD). E:\ is used for downloads, F:\ for DATA, G:\ for my authoring work. H:\ is for MSMG, programming/scripting and related tasks and so on. D: - F: are common to all PCs. All PCs have 1 - 2 Optical drives. So I'm looking for a way to change the drive letters within my script so I don't have to install Windows, manually change a few things, then run the script to do all the other tasks (Which includes adding labels to drives, moving the page file, etc. My script (which I posted a couple of months ago does get the drive it's running from "SET SRC=%CD:~0,2%", but that is for use within the script. Not the same thing.