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. ingviowarr

    ingviowarr MDL Member

    Dec 14, 2009
    226
    173
    10
    If you tell me where to check the Index Name for sure, then I'll edit and will try again.
     
  2. mdl052020

    mdl052020 MDL Senior Member

    May 31, 2020
    441
    435
    10
    #42 mdl052020, Sep 22, 2020
    Last edited: Sep 22, 2020
    (OP)
    [Powershell -Command " " is to execute Powershell Function Within the Batch script]

    PS C:\> Get-Help Get-WindowsImage

    NAME
    Get-WindowsImage

    SYNTAX
    Get-WindowsImage -ImagePath <string> [-LogPath <string>] [-ScratchDirectory <string>] [-LogLevel {Errors |
    Warnings | WarningsInfo}] [<CommonParameters>]

    Get-WindowsImage -ImagePath <string> -Name <string> [-LogPath <string>] [-ScratchDirectory <string>] [-LogLevel
    {Errors | Warnings | WarningsInfo}] [<CommonParameters>]

    Get-WindowsImage -ImagePath <string> -Index <uint32> [-LogPath <string>] [-ScratchDirectory <string>] [-LogLevel
    {Errors | Warnings | WarningsInfo}] [<CommonParameters>]

    Get-WindowsImage -Mounted [-LogPath <string>] [-ScratchDirectory <string>] [-LogLevel {Errors | Warnings |
    WarningsInfo}] [<CommonParameters>]


    Powershell -Command "Get-WindowsImage -ImagePath '%~dp0Win10\sources\install.wim'"
     
  3. ingviowarr

    ingviowarr MDL Member

    Dec 14, 2009
    226
    173
    10
    #43 ingviowarr, Sep 22, 2020
    Last edited: Sep 22, 2020
    OK. You was first again. But I'm already have my variant:

    PowerShell

    Code:
    Get-WindowsImage -ImagePath "D:\MSMG\DVD\sources\install.wim"
    Code:
    ImageIndex         : 1
    ImageName          : Windows 10 Корпоративная
    ImageDescription   : Windows 10 Корпоративная
    ImageSize          : 11,485,689,449 bytes

    ---------------
    Wait a minute, then I'll try your commands.

    UPD: OK, nothing helpfull any more. The command works with *.wim or *.vhd and can't get info about ISO.
    Will try this stupid "Windows 10 Корпоративная"
     
  4. ingviowarr

    ingviowarr MDL Member

    Dec 14, 2009
    226
    173
    10
    1) Exactly same errors as before:
    - Or Index, or Name is required, not both.
    - Some source file were not found.
    (See above my first post with log).

    2) If you clearing User's Temp folder, then only files should be deleted, but not the folder itself.
    Or the repeated launch without reboot may fail.
     
  5. zero cool root

    zero cool root MDL Senior Member

    Jun 17, 2011
    264
    60
    10
    Thank you, I will try. Yes, I have language ISO PT-BR..!!
     
  6. ingviowarr

    ingviowarr MDL Member

    Dec 14, 2009
    226
    173
    10
    #46 ingviowarr, Sep 22, 2020
    Last edited: Sep 22, 2020
    Now I can't clear/delete folders and files inside the User's Temp:
    Code:
    %USERNAME%\AppData\Local\Temp\Mount
    The folder is locked and full of garbage. This is very bad situation for anybody.
    (But that was temporary installation and I can reinstall this machine)

    Be careful, my friend.

    UPD:
    Changing folder security from Thrustedinstaller to User Admin account worked.
    The Mount folder was cleared successfully.
     
  7. ingviowarr

    ingviowarr MDL Member

    Dec 14, 2009
    226
    173
    10
    #47 ingviowarr, Sep 22, 2020
    Last edited: Sep 22, 2020
    May be a good way would be integration of your ideas just into the MSMG?
    Some kind like "Advanced options" for MSMG.
    MSMG have no issues when working with folders, security permissions, localizations, etc.
    Think about it.
     
  8. mdl052020

    mdl052020 MDL Senior Member

    May 31, 2020
    441
    435
    10
    if you already have a single index wim then why dont you skip exporting it.

    just skip it & second move option too .

    theres no any need to export a single index un serviced wim . Please try to understand the ethics.
     
  9. mdl052020

    mdl052020 MDL Senior Member

    May 31, 2020
    441
    435
    10
    if you terminated the script process in between after mounting the wim image then you have to dismount it first & if dismount dont work then clear the corrupt mount points & your mount directory will be empty by itself . please try to understand the ethics first of servicing a wim image .
     
  10. mdl052020

    mdl052020 MDL Senior Member

    May 31, 2020
    441
    435
    10
    i dont have any issue if msmg wants to use powershell functions within his script. he is most welcome to use any of the coding functions of my script but still i think he already knows all these powershell functions .
     
  11. ingviowarr

    ingviowarr MDL Member

    Dec 14, 2009
    226
    173
    10
    I'm a very new with modding an images.
    So no idea, what parameters are necessary and what are not.

    My ethics is the next: you are the coder here, so it's you who gets the knockouts :)

    OK. The next part when -SourceName 'Windows 10 Pro' has been removed:

    Code:
    --- Exporting Windows 10 Pro Index From Source Wim Image to Temporary Directory
    
    Export-WindowsImage : It is not possible to resolve a set of parameters using the specified named parameters.
    line:1 symbol:1
    + Export-WindowsImage -SourceImagePath 'D:\W10DBL\Win10\sources\install ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidArgument: (:) [Export-WindowsImage], ParameterBindingException
        + FullyQualifiedErrorId : AmbiguousParameterSet,Microsoft.Dism.Commands.ExportWindowsImageCommand
    
    
    --- Moving Back Exported WIM Image to its Source Path
    
    It is impossible to find the specified file.
    Nevertheless, the scenario finished till the end. (I'm just closed windows one by one)
     
  12. ingviowarr

    ingviowarr MDL Member

    Dec 14, 2009
    226
    173
    10
    Please, give me a command to unmount - to be launched malually, not in the script context.
    Next time I'll try to unmount before changing the folder permissions, that should be much faster to delete a garbage (if any error).
     
  13. Carlos Detweiller

    Carlos Detweiller MDL Spinning Tortoise

    Dec 21, 2012
    4,183
    4,054
    150
    Try

    Code:
    dism.exe /cleanup-wim
    at the command line with Admin rights. This will try to cleanup stale files and unmount leftovers.
     
  14. ingviowarr

    ingviowarr MDL Member

    Dec 14, 2009
    226
    173
    10
  15. zero cool root

    zero cool root MDL Senior Member

    Jun 17, 2011
    264
    60
    10
    Now works fine for me..!!

    Thank you so much..!!
     
  16. mdl052020

    mdl052020 MDL Senior Member

    May 31, 2020
    441
    435
    10
    Most Welcome @zero cool root
    Please Suggest Any Kind of Improvement you want to be implemented in the script to make this project more user friendly.
    Please Also Review your Experience After Installing Final Debloated ISO as a Guest Machine on any VM App.
     
  17. ingviowarr

    ingviowarr MDL Member

    Dec 14, 2009
    226
    173
    10
    @mdl052020

    1) For me it worked like this (without errors):
    Code:
    Powershell -Command "Export-WindowsImage -SourceImagePath '%~dp0Win10\sources\install.wim' -SourceIndex 1 -DestinationImagePath '%tmp%\install.wim'"
    where -SourceIndex N is a must parameter for the Export-WindowsImage command

    For example, you may show to the user the list of Editions first (smth. like that):
    Code:
    Powershell -Command "Get-WindowsImage -ImagePath '%~dp0Win10\sources\install.wim'"
    And then ask the user input a number of the image (for exporting, moving, etc.)

    2) Reminding you. As I said before:

    If you clearing User's Temp folder, then only files should be deleted, but not the folder itself.
    After script exit, the User's Temp folder appears deleted, so if I want to use 7-Zip app, for example, nothing can be extracted (system error).

    3) Some DISM errors from the system dism.log (no idea whether they are critical or not):
    Code:
    Info DISM API: PID=8 TID=2052 Lookup in table by path failed for: DummyPath-2BA51B78-C7F7-4910-B99D-BB7345357CDC - CTransactionalImageTable::LookupImagePath
    ...
    Info DISM API: PID=8 TID=2052 Lookup in table by path failed for: 1376341382_851968_23412 - CTransactionalImageTable::LookupImagePath
    Info DISM API: PID=8 TID=2052 Lookup in table by path failed for: 1376341382_851968_23412 - CTransactionalImageTable::LookupImagePath
    ...
    Info DISM DISM Provider Store: PID=8 TID=1108 Failed to get and initialize the PE Provider.  Continuing by assuming that it is not a WinPE image. - CDISMProviderStore::Final_OnConnect
    ...
    Info DISM API: PID=1444 TID=5960 Lookup in table by path failed for: DummyPath-2BA51B78-C7F7-4910-B99D-BB7345357CDC - CTransactionalImageTable::LookupImagePath
    ...
    Info DISM API: PID=6072 TID=3136 Lookup in table by path failed for: 1376341382_851968_23412 - CTransactionalImageTable::LookupImagePath
    ...
    Warning DISM DISM Provider Store: PID=6072 TID=6024 Failed to load the provider: C:\Windows\SYSTEM32\Dism\SiloedPackageProvider.dll. - CDISMProviderStore::Internal_GetProvider(hr:0x8007007e)
    ...
    Warning DISM DISM Provider Store: PID=6072 TID=6024 Failed to load the provider: C:\Windows\SYSTEM32\Dism\MetaDeployProvider.dll. - CDISMProviderStore::Internal_GetProvider(hr:0x8007007e)
    ...
    Warning DISM Provider Store: PID=4980 TID=2304 Failed to load the provider: C:\Users\TMP\AppData\Local\Temp\62EDDD54-CBAF-4C23-9A9F-89F9968C0B70\PEProvider.dll. - CDISMProviderStore::Internal_GetProvider(hr:0x8007007e)
    ...
    Info CBS Failed to find a matching version for servicing stack: C:\Users\TMP\AppData\Local\Temp\Mount\Windows\WinSxS\amd64_microsoft-windows-servicingstack_31bf3856ad364e35_10.0.19041.504_none_e781e76525fb2269\ [HRESULT = 0x80070490 - ERROR_NOT_FOUND]
     
  18. mdl052020

    mdl052020 MDL Senior Member

    May 31, 2020
    441
    435
    10
    IDK why You are Trying to Export a Single Index Wim Image , Please Learn Basics of Wim Servicing.


    Info CBS Failed to find a matching version for servicing stack: C:\Users\TMP\AppData\Local\Temp\Mount\Windows\WinSxS\amd64_microsoft-windows-servicingstack_31bf3856ad364e35_10.0.19041.504_none_e781e76525fb2269\ [HRESULT = 0x80070490 - ERROR_NOT_FOUND]

    This One is Important HRESULT = 0x80070490 ( This is Regarding The Wim You Were Servicing Very Important )
     
  19. ingviowarr

    ingviowarr MDL Member

    Dec 14, 2009
    226
    173
    10
    I just worried about other people want to use your script.
    (I remember you said I can skip this step, same as moving back an exported WIM).
    What I should do in this case? (I'm still want we achieve a healthy work in general, before I start cutting the packs).
    If you have some recommendations for me, I would be appreciated :)
     
  20. ingviowarr

    ingviowarr MDL Member

    Dec 14, 2009
    226
    173
    10
    #60 ingviowarr, Sep 23, 2020
    Last edited: Sep 23, 2020
    1) Source (like adguard or so) : 2004 build 19041.508 Original Microsoft MSDN [RU] with integrated updates
    2) MSMG
    3) Your script

    I looked at that: Original Microsoft MSDN and decided this is a good distributive to start modding...

    UPD:
    I tried to check with manual update and Windows said KB4577266 (Last SSU) is already installed.
    So it is already here.