1. Jingzin

    Jingzin MDL Addicted

    Nov 10, 2021
    666
    536
    30
    Sequence is really extremely simple, worked it out myself took me like half a year actually dealing with windows 11 pro.

    Get yourself 22621.1 just download from uup without updates. then use toolkit to remove whatever you want to remove. then install windows.

    then run cmd
    sfc /scannow you likely will get error that corrected itself.
    then run
    Dism.exe /online /Cleanup-Image /StartComponentCleanup /ResetBase
    it will take time after that run
    Dism /Online /Cleanup-Image /ScanHealth
    after that you will see errors i was unable correct these errors myself no matter what i did its something to do with msmg toolkit.
    its an old error affecting all win 11 versions and the only way to bypass it was to never run dism resetbase or component cleanup yet to correct it

    using windows update or wumt or similar after you installed 22621.1 update windows to 22621.2823 as i did it doesnt include copilot nor backup app, or to 22631 with a bit more mscrapwae. after update only few aps will get reinstalled after rebooting open regedit go tp svchost
    Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Svchost
    remove Usosvc from netsvcs in that way your windows updates will get disabled as if you paused it, but you will still be able to use msstore, wumt and similar to install updates or you can just simply add usosvc to netsvcs to enable windows updates whenever you want

    updating windows from 22621.1 to next version next any version pros of doing it is that dism resetbase, component cleanup will work again and if you run scanhealth you will get no errors

    minus is that if you update to 22631 you will get windows backup app which you wont be able to remove you will also get defender and few other apps you will have to disable if you wanted it disabled its simple just again disable tamper protection in regedit after booting into safe mode. then again in safe mode using autoruns disable all tasks you dont want plus disable all apps you dont want including defender.

    i would also advice to disable dcom over regedit its simple just google it.

    also would advice to if you can go to bios and enable intel dynamic tuning technology if you do that and you got asus motherboard then after doing it download driver for your motherboard from asus website or else motherboard you got from,
    pros of doing it is that windows willl calm down means after you removed all that interconnected crapware msware from your windows iso there will always be missing links you will get errors in even viewer you will see system interrupts running at 1 or 2 or more percent after enabling IDTT nothing is running on my pc. after i boot up cpu goes down to 0.1 and 0 percent at 0.45ghz and no service is running no system interrupts etc. i only was able to achieve it using ltsb 2016 but never win 11 pro.

    plus you can do a few tweaks like
    .\SU64 /w /s Powershell "LS HKLM:\SOFTWARE -Recurse -ea 0|? Name -M 'smartscreen'|RI -Recurse"
    to remove remnants of smartscreen running in task manager after you removed smartscreen with msmg toolkit.

    then when you finish setting up your windows open dism++ go to toolkit, system backup and create backup.wim you can restore anytime you want i always do that for example created iso with msmg toolkit, installed it then make backup.wim with dism++ then tweak things over and over remove disable stuff in regedit etc. making backup.wim sometimes so if
    sfc /scannow
    Dism /Online /Cleanup-Image /ScanHealth shows errors after i removed something i shouldnt and i cant correct it i can always easily use backup.wim takes 3 min to restore windows.

    hope i could help
     
  2. ORZpasserAtw

    ORZpasserAtw MDL Novice

    Sep 8, 2020
    18
    4
    0
    Windows 10 19045 with 3633 feature update also included "Windows Backup" this crap UWP app. hope next update can get rid of it
     
  3. Asterix4you

    Asterix4you MDL Novice

    Oct 17, 2017
    16
    0
    0
    Hi, is it possible to embed some *.ps1 files in both oobe and normal modes?
     
  4. mhussain

    mhussain MDL Senior Member

    Oct 1, 2012
    384
    161
    10
    I thought windows backup was part of the remove list for msmg toolkit?
    if this new version is seperate could this component be added?
    I hope your health sir msmg is doing well.
    I am not going to ask you for when the next version is being released.
    take care sir.
     
  5. Jingzin

    Jingzin MDL Addicted

    Nov 10, 2021
    666
    536
    30
    Theres new windows backup app Microsoft is shipping with updates. To add it just update your windows 11
     
  6. Yanta

    Yanta MDL Senior Member

    May 21, 2017
    491
    284
    10
    I am trying to write a script to automate the allocation of drive letters on systems with Windows installed from the images created with the toolkit.
    Using powershell the get-partition, get-volume... in fact all storage related commands return nothing.
    Is there a component that needs to be retained for powershell's storage commands to work?
     
  7. sakatgg

    sakatgg MDL Junior Member

    Jun 18, 2020
    66
    40
    0
    #26567 sakatgg, Nov 16, 2023
    Last edited: Nov 17, 2023
    I want the RAM disk to be on B:, when deployed I export these registry keys from the previously installed one to the new one

    [HKEY_LOCAL_MACHINE\SYSTEM\MountedDevices]
    "\\DosDevices\\C:"=hex:9b,92,db,ba,00,00,10,00,00,00,00,00
    "\\DosDevices\\D:"=hex:ec,35,0f,61,00,00,10,00,00,00,00,00
    "\\DosDevices\\B:"=hex:bf,d5,7a,d9,00,00,10,00,00,00,00,00

    P.S.

    This is a method of assigning drive letters according to your wishes, and not randomly
    As I understand, you want to automate the process of assigning drive letters as you wish?
     
  8. Yanta

    Yanta MDL Senior Member

    May 21, 2017
    491
    284
    10
    Did you quote the wrong message?

    This is not related to my question.

     
  9. Yanta

    Yanta MDL Senior Member

    May 21, 2017
    491
    284
    10
    #26569 Yanta, Nov 17, 2023
    Last edited: Nov 17, 2023
    Well, yes, sort of. What I'm actually trying to figure out is why my powershell storage commands don't work.

    Here''s the script I have now...

    Code:
    <# : batch script
    @echo off
    powershell -nop Invoke-Expression ('$OldDrive = """"%1""""; $NewDrive = """"%2""""' + [System.IO.File]::ReadAllText('%~f0'))
    goto :eof
    #>
    
    if ((Get-Partition -DriveLetter $OldDrive -ErrorAction Ignore) -eq $null) {
        "{0}: is not assigned." -f $OldDrive
        exit 0
    }
    
    if ((Get-Partition -DriveLetter $NewDrive -ErrorAction Ignore) -ne $null) {
        "{0}: is unavailable." -f $NewDrive
        exit 0
    }
    
    try {
        Set-Partition -DriveLetter $OldDrive -NewDriveLetter $NewDrive
        "Changed {0}: to {1}:" -f $OldDrive, $NewDrive
    }
    catch {
        $_.Exception.Message
        exit 1
    }
    
    But something is broken with powershell. When using get-partition it returns nothing so I figured I probably removed a component necessary for making powershell storage commands work and my question is "What component do I need to retain".
     
  10. xlincn

    xlincn MDL Junior Member

    Nov 9, 2013
    59
    18
    0
    the new system is no longer available and is looking forward to the update
     
  11. MrNico98

    MrNico98 MDL Junior Member

    May 9, 2023
    56
    7
    0
    toolkit is dead? no update...
     
  12. Feartamixg

    Feartamixg MDL Addicted

    May 15, 2016
    786
    631
    30
    While I admit that the delay since the last update is troubling me a little, I do think we owe it to @MSMG to show our patience. They may have troubles in life or with their health right now and we should remember that @MSMG is human, just like the rest of us.
     
  13. Ace2

    Ace2 MDL Guru

    Oct 10, 2014
    2,206
    1,909
    90
    No, toolkit is not dead, the problem is, there are to many CU updates at any given time, keeping toolkit up to date, would be to much work for anyone, when they have there own life to live.
     
  14. kandido

    kandido MDL Junior Member

    Jun 14, 2015
    61
    37
    0
    you're exactly right, sir :)
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  15. inTerActionVRI

    inTerActionVRI MDL Expert

    Sep 23, 2009
    1,770
    3,601
    60
    #26575 inTerActionVRI, Nov 20, 2023
    Last edited: Nov 20, 2023
    Was this batch supposed to be run within PowerShell?
    Or was it really just a commented block to serve as a reminder?

    What are OldDrive and NewDrive Var and how did you get them?

    Whats is the expected result with "[System.IO.File]::ReadAllText('%~f0')"?
    if you need only drive, you should use %~d0.


    To run cmd code inside powershell, even if it calls powershell back, you would need to use the command cmd.exe /C.
    I made some changes to the quotation marks and that positive sign, I don't know if you wanted to concatenate the result or if you wanted to do it the way I put it, in which the 3 codes are being executed in sequence.
    Just like this:
    Code:
    cmd.exe /C "PowerShell.exe -nop Invoke-Expression ('$OldDrive = """"%1""""; $NewDrive = """"%2""""; [System.IO.File]::ReadAllText("%~f0")')"

    From what I interpreted, you are not detecting the disks, but rather, you are passing them, in the form of arguments to powershell?
    you can use $Args[0] as the first argument and $Args[1] as the second argument and so on.
    if they are not empty:
    Code:
    if ( $Args[0] ) { $OldDrive = [System.IO.Path]::GetFullPath( ( $Args[0] -Replace "\*", "%2A" ).ToString() ) }
    if ( $Args[1] ) { $NewDrive = [System.IO.Path]::GetFullPath( ( $Args[1] -Replace "\*", "%2A" ).ToString() ) }
    if ( $OldDrive ) { $OldDrive = $OldDrive.TrimEnd("\") }
    if ( $NewDrive ) { $NewDrive = $NewDrive.TrimEnd("\") }
    

    I dont know if these commands could be useful for you, but follow commands to get only Partitions with letter or only letters.
    Code:
    Get-Partition | Where-Object { $_.DriveLetter }
    
    Will get partition with and without letter
    Code:
    Get-Partition.DriveLetter
    
    Will get only letter
    Code:
    ( Get-Partition | Where-Object { $_.DriveLetter } ).DriveLetter
    
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  16. Yanta

    Yanta MDL Senior Member

    May 21, 2017
    491
    284
    10
    #26576 Yanta, Nov 21, 2023
    Last edited: Nov 21, 2023
    Yes, the syntax is chgdrive X Y and it works fine on systems with working powershell.

    The code is correct, the problem is on any system I've built using MSMG toolkit the powershell storage commands do not work.

    If I install a vanilla, untouched 19044 21H2 they work fine.

    Not a single one of the storage commands work.
    I've checked, the storage module is installed.

    The commands would be useful to me if my powershell would run storage cmdlets, but it doesn't.
    This is a valid method of invoking poweshell within a batch script.
    Code:
    <# : batch script
    @echo off
    powershell -nop Invoke-Expression ('$OldDrive = """"%1""""; $NewDrive = """"%2""""' + [System.IO.File]::ReadAllText('%~f0'))
    goto :eof
    #>
    
    If I run chgdrive J A it will tell me drive J: is not assigned, even though it is. If I simply type get-partition at a PS prompt it returns nothing.

    Code:
    PS C:\Users\Tanya> get-disk
    PS C:\Users\Tanya> get-partition
    PS C:\Users\Tanya> get-volume
    PS C:\Users\Tanya> Get-Partition | Where-Object { $_.DriveLetter }
    PS C:\Users\Tanya> ( Get-Partition | Where-Object { $_.DriveLetter } ).DriveLetter
    PS C:\Users\Tanya> Get-Partition.DriveLetter
    Get-Partition.DriveLetter : The term 'Get-Partition.DriveLetter' is not recognized as the name of a cmdlet, function,
    script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is
    correct and try again.
    At line:1 char:1
    + Get-Partition.DriveLetter
    + ~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : ObjectNotFound: (Get-Partition.DriveLetter:String) [], CommandNotFoundException
        + FullyQualifiedErrorId : CommandNotFoundException
    
    I also tried installing Powershell 7.4.0 but I get the same results.

    Using
    Code:
    cmd.exe /C "PowerShell.exe -nop Invoke-Expression ('$OldDrive = """"%1""""; $NewDrive = """"%2""""; [System.IO.File]::ReadAllText("%~f0")')"
    
    results in
    Code:
    I:\PostInstall>cmd.exe /C "PowerShell.exe -nop Invoke-Expression ('$OldDrive = """"x""""; $NewDrive = """"y""""; [System.IO.File]::ReadAllText("I:\PostInstall\test.cmd")')"
    Invoke-Expression : At line:1 char:65
    + ... dDrive = "x"; $NewDrive = "y"; [System.IO.File]::ReadAllText(I:\PostI ...
    +                                                                  ~
    Missing ')' in method call.
    At line:1 char:65
    + ... ewDrive = "y"; [System.IO.File]::ReadAllText(I:\PostInstall\test.cmd)
    +                                                  ~~~~~~~~~~~~~~~~~~~~~~~
    Unexpected token 'I:\PostInstall\test.cmd' in expression or statement.
    At line:1 char:88
    + ... ewDrive = "y"; [System.IO.File]::ReadAllText(I:\PostInstall\test.cmd)
    +                                                                         ~
    Unexpected token ')' in expression or statement.
    At line:1 char:1
    + Invoke-Expression ('$OldDrive = "x"; $NewDrive = "y"; [System.IO.File ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : ParserError: (:) [Invoke-Expression], ParseException
        + FullyQualifiedErrorId : MissingEndParenthesisInMethodCall,Microsoft.PowerShell.Commands.InvokeExpressionCommand
    
    -DriveLetter was unexpected at this time.
    I:\PostInstall>if ((Get-Partition -DriveLetter $OldDrive -ErrorAction Ignore) -eq $null) {
    I:\PostInstall>
    
     
  17. tempdrive1

    tempdrive1 MDL Member

    Aug 29, 2021
    103
    135
    10
    To me it looks like you are not escaping your quotes properly.
    The PowerShell interpreter processes ReadAllText(I:\PostI, and you can see the path is not a text, as it is not surrounded by quotes.
    Try to be consistent, use single quotes for the wrapper (outermost quoting, right after cmd /C and at the very end), and use double quotes inside.
    Probably could be done better justice, but the error messages seem to show clear indications where the problems comes from: that little ~ below the path for ReadAllText.

    Personally I find it a bit weird you read in a .cmd file, but there are many solutions to a problem in IT, so do whatever you feel like doing.
     
  18. imlost2

    imlost2 MDL Member

    Aug 5, 2013
    183
    185
    10
    #26578 imlost2, Nov 21, 2023
    Last edited: Dec 6, 2023
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  19. Yanta

    Yanta MDL Senior Member

    May 21, 2017
    491
    284
    10
    The cmd /c is not my code. And yes, I was aware of the issue with quotes. Anyway, I'm not using that code,

    In any case, I think the point is being lost. I should not have posted the code as this has caused the whole thing to go off topic. Can we please ignore the code - my code works fine. It's powershell that's not working.

    The original post, and only issue I'm seeking assistance with is that powershell storage commands don't work on any system for which I've created an image using the MSMG toolkit. If I install a plain vanilla Windows 10 with nothing touched it all works fine.

    So either I removed a component necessary for making powershell cmdlets work, or something else is broken.

    And my question was "What component, if any, needs to be retained for powerchell storage cmdlets to work".
     
  20. tempdrive1

    tempdrive1 MDL Member

    Aug 29, 2021
    103
    135
    10
    Do binary testing, looks like your best option at this point.
    You could be done in a couple of hours.