1. MIMMO61

    MIMMO61 MDL Senior Member

    Aug 19, 2009
    372
    107
    10
    #11901 MIMMO61, Aug 29, 2019
    Last edited: Aug 29, 2019
  2. budzos

    budzos MDL Expert

    Mar 13, 2009
    1,013
    2,299
    60
    I also removed a bunch of stuff. Should I first remove what I need removed in version 8.8, Then reopen in 9.3 and convert it?
    Thanks for the kind reply MSMG. I have been using Windows 7 forever but need 8.1 for nvme support.
    budzos
     
  3. MSMG

    MSMG MDL Developer

    Jul 15, 2011
    6,414
    15,608
    210
    First you use v9.3 to convert the edition and then re-open the image with v8.3 for removal.

    Will add a temporarily solution for component removal for W7/W81 in v9.4 using Remove Windows Component using Package List to avoid using two version of ToolKit.


     
  4. budzos

    budzos MDL Expert

    Mar 13, 2009
    1,013
    2,299
    60
    Thanks again MSMG, I will give that a shot.
    budzos
     
  5. cuzzon

    cuzzon MDL Novice

    Jul 27, 2017
    13
    7
    0
    Bahh i knew it i messed up ! I was running from IDE with working directory holding ps1 and reg files, not from command prompt (with usually workdir set to current user). It was working directory that may have messed things up.
    One other thing i didn't check for is result of $path = [System.IO.Path]::GetDirectoryName($file) it had a backslash. If file resides in root dir, it will have a backslash, but if that is some subdirectory it will not.
    This is relevant as the final filename is built with "\converted_" string inserted.
     
  6. cuzzon

    cuzzon MDL Novice

    Jul 27, 2017
    13
    7
    0
    @MSMG i copied the PS code and modified it to ensure input arguments are properly defined at command line
    Code:
    # test if first argument is defined / given at command line
    if ($args[0] -eq $null)
        {
            # can be replaced with Exit 1 to denote failure if used in batch cmd
            throw [System.IO.DirectoryNotFoundException]::new("Source directory not defined !")
        }
    
    # test if first argument is a directory and exists
    if ((Test-Path -Path $args[0].ToString() -PathType Container) -eq $false)
        {
        throw [System.IO.DirectoryNotFoundException]::new("First argument is not a directory !")
        }
    
    # test if second argument is defined / given at command line
    if ($args[1] -eq $null)
        {
            throw [System.IO.DirectoryNotFoundException]::new("Target directory not defined !")
        }
    
    # test if second argument is a directory and exists
    if ((Test-Path -Path $args[1].ToString() -PathType Container) -eq $false)
        {
            throw [System.IO.DirectoryNotFoundException]::new("Second argument is not a directory !")
        }
    
    # using ToString() for arguments ensures that if supplied directory name is all numbers it won't fail (it won't think its a number but a string)
    # Combine() ensures that if directory path does not have backslash \ at end it will work anyway
    $sourcedir = [System.IO.Path]::Combine($args[0].ToString(),".\") + "\*"
    $targetdir = [System.IO.Path]::Combine($args[1].ToString(),".\")
    
    $input_values = Get-ChildItem -Path $sourcedir -Include *.reg
    
     #moved out of loop, no need to re-define it on each iteration :)
     [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"}
    
    foreach ($file in $input_values)
    {
        #regex ensures that all commented lines are ignored
        [System.Collections.ArrayList]$content = Get-content -Path $file | Where { $_ -notmatch "^(\s+)?;|^\s*$" }
        [string]$output = ""
        [string]$newline = ""
    
        foreach($line in $content)
        {
            # regex ensures to catch all lines with angle brackets (they contain registry keys)
            if ($line -match "^\[.*\]$")
            {
                #search and replace keys to toolkit-compatible format
                foreach($key in $equivalents.Keys)
                {
                    if ($line.Contains($key))
                    {
                        $newline = $line.Replace($key, $equivalents[$key])
                        break
                    }
                }
            }
            else
            {
                $newline = $line
            }
            $output += $newline + "`r`n"
        }
        # $file is of type System.IO.FileSystemInfo so it is simple as referencing its 'Name' property to get actual file name
        Set-Content -Path ($targetdir + $file.Name) -Value $output
    }
    
    
    Note the comments as they provide info on what is added and why.
     
  7. MSMG

    MSMG MDL Developer

    Jul 15, 2011
    6,414
    15,608
    210
    Thanks, updated the convert registry script with the new changes.

     
  8. MSMG

    MSMG MDL Developer

    Jul 15, 2011
    6,414
    15,608
    210
    Yes Finished uploading the packs, cleaning up the Toolkit script, updating the change-log and HASH.

    Still pending is to add protection to the ToolKitHelper.exe and re-test it, then pack up, upload and publish the ToolKit.

    Monday, 2 September is the release date.

     
  9. windows builder

    windows builder MDL Guru

    Sep 13, 2017
    2,219
    1,555
    90
    OMG!!! :worthy::worthy::worthy: finally.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  10. °ツ

    °ツ MDL Addicted

    Jun 8, 2014
    904
    1,181
    30
    I haven't been reading this thread for a long time since I use other software for this task but what happened with the GUI version? It was supposed to be released long time ago.
     
  11. spidernz

    spidernz MDL Senior Member

    May 20, 2011
    390
    114
    10
    Yes!! Thank you

    Can build new windows on my day off :D
     
  12. Yanta

    Yanta MDL Senior Member

    May 21, 2017
    477
    274
    10
    Did you find a work around for preventing the removed components from being restored?
     
  13. Windows 10 User

    Windows 10 User MDL Guru

    Feb 2, 2017
    2,006
    122
    90
    As well as being able to install updates via WU after removing the restored components.
     
  14. rayleigh_otter

    rayleigh_otter MDL Expert

    Aug 8, 2018
    1,121
    933
    60
    :mad:
     
  15. Tiger-1

    Tiger-1 MDL Guru

    Oct 18, 2014
    7,894
    10,735
    240
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  16. MSMG

    MSMG MDL Developer

    Jul 15, 2011
    6,414
    15,608
    210
    It has been delayed due to personal issues.

     
  17. MSMG

    MSMG MDL Developer

    Jul 15, 2011
    6,414
    15,608
    210
    No not yet, will release the new version and then will try out different methods of component removal to see which is better one to retain WU working and also not to return the removed components for v19H1.