Win10 Tweaking Scripts

Discussion in 'Scripting' started by mdl052020, Jul 29, 2020.

?

Do you like these batch scripts?

Poll closed Dec 31, 2020.
  1. Yes

    38 vote(s)
    90.5%
  2. No

    4 vote(s)
    9.5%
Multiple votes are allowed.
  1. mdl052020

    mdl052020 MDL Senior Member

    May 31, 2020
    441
    435
    10
    Have You Executed the Script With Admin Privileges or directly clicked on script to be executed.
     
  2. zero cool root

    zero cool root MDL Senior Member

    Jun 17, 2011
    264
    60
    10
    I tried both..!!
     
  3. mdl052020

    mdl052020 MDL Senior Member

    May 31, 2020
    441
    435
    10
    Which HOST OS you are using to Execute the Script Win10 or Win7 . For Win7 It Wont Work so You Must use Win10 Host OS Min Build 17134.xxx .
    Always Execute Script as Admin Via Right Click.
     
  4. zero cool root

    zero cool root MDL Senior Member

    Jun 17, 2011
    264
    60
    10
    My host OS is Win10 20H1 and I was execute Script as Admin..!!
     
  5. mdl052020

    mdl052020 MDL Senior Member

    May 31, 2020
    441
    435
    10
    #25 mdl052020, Sep 22, 2020
    Last edited: Sep 22, 2020
    (OP)
    1. Is it Host or Guest OS & Please Be Sure to Put Both ISO & Script at Same Path ie OS - Desktop or else Script Wont Work.
    2. Please Take Screenshot of Errors & Upload them here so that i could better work on it.
    2.Have You tweaked or Enabled Controlled Folder Access on Your System OS Desktop Directory
    3. Please Try a Fresh Installed Win 10 OS & Cross Check if Problem Persists.
    4. My friends haven't reported me any issue like this as you are facing.

    Edit : As i have seen You Are Using a Install.esd iso .
    An ISO with install.wim will work with the script or else edit the script & filter *.wim then change .wim to .esd.
     
  6. ingviowarr

    ingviowarr MDL Member

    Dec 14, 2009
    226
    173
    10
    @mdl052020
    I have an errors. As I can see, they are relative to the wrong user pathes for non-English Windows.
    I think you shouldn't use smth. like: C:\Users\... or any user-protected folders - Desktop, etc.

    Try to use some independent TEMP folder inside the path, where cmd launches. E.g. for me it will be:
    D:\W10DBLT\TEMP\...
    Then delete this TEMP folder after exit from the script.

    If you decide to use system user-folders anyway, don't forget use the universal pathes (for any localizations).
    E.g. for TEMP folder:
    Code:
    %USERNAME%\AppData\Local\Temp\
    For example, there is no such folder on russian-language Windows:
    Code:
    C:\Users
    Instead it's looking like that:
    Code:
    C:\Пользователи
    Stupid? Yeah... Certified dumbasses from M$...
     
  7. mdl052020

    mdl052020 MDL Senior Member

    May 31, 2020
    441
    435
    10
    Thanks a lot . i have noted down your query & will update it in next release.
    it must be %AppData%\Temp correctly as per User Env Variables Structures.
     
  8. ingviowarr

    ingviowarr MDL Member

    Dec 14, 2009
    226
    173
    10
    For the TEMP you can also use smth. like that:
    Code:
    cd /d "%~dp0"
     
  9. mdl052020

    mdl052020 MDL Senior Member

    May 31, 2020
    441
    435
    10
    CD [/D] [drive:][path]
    &
    %~dp0 means the same path as script
     
  10. zero cool root

    zero cool root MDL Senior Member

    Jun 17, 2011
    264
    60
    10
    Thanks in advance..!!
     
  11. ingviowarr

    ingviowarr MDL Member

    Dec 14, 2009
    226
    173
    10
    Yes it is.

    For example, the header for the script:
    Code:
    ::::::::  Color and UTF8 Encoding
    
    :First
    @echo off
    @chcp 65001
    CLS
    COLOR 3
    
    ::::::::  Current launch folder
    
    cd /d "%~dp0"
    
    ::::::::  Assignment of variables
    
    set "TEMP=%~dp0TEMP"
    Then you can use this path in any variant of cmd commands:
    "%TEMP%"
     
  12. ingviowarr

    ingviowarr MDL Member

    Dec 14, 2009
    226
    173
    10
    #32 ingviowarr, Sep 22, 2020
    Last edited: Sep 22, 2020
    @mdl052020
    FYI: I'm also widely use an exellent "PowerRun" tool inside my cmd bundles.
    Feel free to add it just to your core folder, if you need, for all-in-one package.
    E.g.:
    Code:
    ...\W10DBLT\Files\PowerRun_x64.exe
    Then
    Code:
    ::::::::  Assignment of variables
    
    set xOS=x64& (If "%PROCESSOR_ARCHITECTURE%"=="x86" If Not Defined PROCESSOR_ARCHITEW6432 Set xOS=x86)
    set PowerRun="%~dp0Files\PowerRun_%xOS%.exe"
    And path to be widely used:
    %PowerRun%
     
  13. mdl052020

    mdl052020 MDL Senior Member

    May 31, 2020
    441
    435
    10
    #33 mdl052020, Sep 22, 2020
    Last edited: Oct 27, 2020
    (OP)
    Script Updated to First Page
     
  14. mdl052020

    mdl052020 MDL Senior Member

    May 31, 2020
    441
    435
    10
    Did Your Issue Resolved if Not Please Try Updated Script with Common Path . i think you have a different Language ISO then EN-GB too.
     
  15. ingviowarr

    ingviowarr MDL Member

    Dec 14, 2009
    226
    173
    10
    This time I can see 1-st window "Select Features to Disable"
    But some errors are still there:
    Code:
    --- Exporting Windows 10 Pro Index From Source Wim Image to Temporary Directory
    
    Export-WindowsImage : Only one of the Name or Index parameters is required
    line:1 symbol:1
    + Export-WindowsImage -SourceImagePath 'D:\W10DBL\Win10\sources\install ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidArgument: (:) [Export-WindowsImage], PSArgumentException
        + FullyQualifiedErrorId : Export-WindowsImage,Microsoft.Dism.Commands.ExportWindowsImageCommand
    
    
    --- Moving Back Exported WIM Image to its Source Path
    
    It is impossible to find the specified file.
    (Warnings were translated to English for you)

    FYI: I'm trying to apply your script to the image done by MSMG.
    And "Features to Disable" window showing correct state for the packages.
     
  16. mdl052020

    mdl052020 MDL Senior Member

    May 31, 2020
    441
    435
    10
    #36 mdl052020, Sep 22, 2020
    Last edited: Sep 22, 2020
    (OP)
    I think Your Win10 ISO wim image don't have exact "Windows 10 Pro" Index Name i am not using index Number in Export Function rather using Image Name to be extracted as in many scenarios Index Numbers are changed . do you have any better solution for this ?
    or
    Just Edit the Script & Change
    SourceName:Windows 10 Pro to SourceIndex:[Your Wim Image Index Number You Want to be extracted}

    Edit : SourceName:Windows 10 Pro
    & change it to
    SourceIndex: (index number you want to be exported)
     
  17. ingviowarr

    ingviowarr MDL Member

    Dec 14, 2009
    226
    173
    10
    Look at this:
    Code:
    Powershell -Command "Export-WindowsImage -SourceImagePath '%~dp0Win10\sources\install.wim' -SourceName 'Windows 10 Pro' -DestinationImagePath '%tmp%\install.wim'"
    But I working with Enterprise (Business) edition.
    Probably, you have to check the Edition and set variable for this. (???)

    UPD: I late with my message. But you are right.

    I've deleted other editions using MSMG. Only one.

    Should I edit this part to the 'Windows 10 Enterprise'?
     
  18. mdl052020

    mdl052020 MDL Senior Member

    May 31, 2020
    441
    435
    10
    Enterprise Business Edition Also Have Same Index Name as "Windows 10 Pro" in EN-GB Language ISO.
     
  19. ingviowarr

    ingviowarr MDL Member

    Dec 14, 2009
    226
    173
    10
    Where I shoild look at Image Index Number?
     
  20. ingviowarr

    ingviowarr MDL Member

    Dec 14, 2009
    226
    173
    10
    No luck with 'Windows 10 Enterprise' edit.

    Unstoppable errors at the end of log by path:
    C:\Users\TMP\AppData\Local\Temp\Mount\Windows\WinSxS\...

    (other log output above is unreachable, nothing to show)

    Also think about immediate stopping scenario + immediate unmount, if any error.
    Because the folder for unpacking may appear not available for deletion of the produced garbage.
    So I need to reboot, then delete all the rest files produced by the script.
    (Not a big problem, but if you can, think about providing such emergency exit)