Help needed to make a Customized Windows 7 SP2

Discussion in 'Windows 7' started by ashish.k, Jan 7, 2016.

  1. ashish.k

    ashish.k MDL Senior Member

    Dec 27, 2014
    299
    134
    10
  2. harkaz

    harkaz MDL Novice

    Dec 27, 2012
    42
    87
    0
    To change SP number, edit this value in registry: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Windows\CSDVersion to 0x200 (512)

    To hide the installed updates use runasti to super-elevate and modify the registry under: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages. For each package key with a "Visibilty" REG_DWORD subvalue "1" change this value to "2"

    P.S. Also consider using my rebase tool to minimize the winsxs size (since you've hidden the updates you wouldn't want them to be removable as well).
     
  3. ashish.k

    ashish.k MDL Senior Member

    Dec 27, 2014
    299
    134
    10
    #3 ashish.k, Jan 10, 2016
    Last edited by a moderator: Apr 20, 2017
    (OP)
    OK, I've changed SP1 label to SP2 in the system and it works everywhere (winver, System Properties, About option in Help). All Thanks to harkaz for pointing out the registry Keys/Values.

    Now as for hiding all updates the Value of REG_DWORD 'Visibility' must be changed to 2 instead of 1 for all Keys named "Package_for_KB*" where * is random numbers and characters. These Keys/folders are uncountable so I need an automatic solution instead of manually changing the values.
    What I need is a cmd script which I will run using RunAsTI (as suggested by harkaz).

    I've made a sample script but I know it won't work as it is just a basic idea of it. Here it is...

    Code:
    @echo off
    
    echo ============================================================
    echo WARNING! This is really dangerous.
    echo Would you like to proceed? (Y/N)
    echo ============================================================
    echo.
    choice /c yn /n
    If %ERRORLEVEL% NEQ 1 GOTO :QUIT
    
    echo Changing Registry keys
    reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Package_for_KB*" /T REG_DWORD /v "Visibility" /D 2 /F>NUL 2>NUL
    IF %ERRORLEVEL% NEQ 0 GOTO :ERROR
    echo .
    echo Registry keys changed successfully
    goto :QUIT
    
    :QUIT
    echo ============================================================
    echo Press any key to exit...
    echo ============================================================
    pause>NUL
    goto :EOF
    
    :ERROR
    echo ============================================================
    echo The script ran into an unexpected error setting reg key.
    echo Press any key to exit...
    echo ============================================================
    pause>NUL
    goto :EOF
    So I want this script to run as many times as the no. of folders named "Package_for_KB*" and change the REG_DWORD "Visibility" value from 1 to 2.

    How can I do that? :g: Please help me to do so as I'm not that good in cmd scripting. :confused:


    PS: @harkaz, I would have gladly paid you $10 for your Rebase tool but I'm just an undergraduate student and have no source of income yet.
     
  4. abbodi1406

    abbodi1406 MDL KB0000001

    Feb 19, 2011
    16,186
    84,652
    340
    #4 abbodi1406, Jan 10, 2016
    Last edited by a moderator: Apr 20, 2017
    Code:
    @echo off
    %windir%\system32\reg.exe query "HKU\S-1-5-19" 1>nul 2>nul || goto :eof
    setlocal enableextensions
    setLocal EnableDelayedExpansion
    cd /d "%~dp0"
    echo.
    echo Getting Packages Names...
    Dism /English /Online /Get-Packages>Packs.txt
    for /f "tokens=3 delims=: " %%i in ('findstr Package_for_KB Packs.txt') do echo %%i>>PacksNames.txt
    for /f "tokens=3 delims=: " %%i in ('findstr Microsoft-Hyper-V-Integration-Services Packs.txt') do echo %%i>>PacksNames.txt
    for /f "tokens=3 delims=: " %%i in ('findstr Microsoft-Windows-IE Packs.txt') do echo %%i>>PacksNames.txt
    for /f "tokens=3 delims=: " %%i in ('findstr Microsoft-Windows-InternetExplorer-Package-TopLevel Packs.txt') do echo %%i>>PacksNames.txt
    for /f "tokens=3 delims=: " %%i in ('findstr Microsoft-Windows-PlatformUpdate Packs.txt') do echo %%i>>PacksNames.txt
    for /f "tokens=3 delims=: " %%i in ('findstr Microsoft-Windows-RDP Packs.txt') do echo %%i>>PacksNames.txt
    for /f "tokens=3 delims=: " %%i in ('findstr Microsoft-Windows-Security-WindowsActivationTechnologies Packs.txt') do echo %%i>>PacksNames.txt
    for /f "tokens=3 delims=: " %%i in ('findstr Microsoft-Windows-Winhelp Packs.txt') do echo %%i>>PacksNames.txt
    for /f "tokens=3 delims=: " %%i in ('findstr Microsoft-Windows-WinMan Packs.txt') do echo %%i>>PacksNames.txt
    if not exist PacksNames.txt (echo.&echo No visible updates is found&goto :end)
    for /f %%i in (PacksNames.txt) do (
    reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\%%i" /t REG_DWORD /v "Visibility" /d 2 /f >nul
    )
    del PacksNames.txt
    
    :end
    del Packs.txt
    echo.
    echo.
    echo Press any key to Exit
    pause >nul
    goto :eof
    
     
  5. ashish.k

    ashish.k MDL Senior Member

    Dec 27, 2014
    299
    134
    10
    #6 ashish.k, Jan 11, 2016
    Last edited by a moderator: Apr 20, 2017
    (OP)
  6. abbodi1406

    abbodi1406 MDL KB0000001

    Feb 19, 2011
    16,186
    84,652
    340
    just a missing echo , i fixed it
     
  7. ashish.k

    ashish.k MDL Senior Member

    Dec 27, 2014
    299
    134
    10

    Of course Sir, I'm using it in a VM.
     
  8. ashish.k

    ashish.k MDL Senior Member

    Dec 27, 2014
    299
    134
    10
    #10 ashish.k, Jan 28, 2016
    Last edited by a moderator: May 23, 2017
    (OP)
  9. greenworld5588

    greenworld5588 MDL Novice

    Jun 4, 2014
    19
    0
    0
    Thank you ashish.k. tested your method, working nice.
     
  10. greenworld5588

    greenworld5588 MDL Novice

    Jun 4, 2014
    19
    0
    0
    I created install.esd of win7 x64/x86 aio install.wim and put it on the place of win8.1 dvd's sources.During installation it give an error about "invalid installation key" & stops the installation.