Script Dism get pourcent split image to create Free tool like rufus for community

mehdi dakhama 336 Reputation points MVP
2020-11-22T15:13:41.497+00:00

Hi Family,

i need your help, i'm windows developper, i'm working on a free tool to help community to create a USB bootable mbr and uefi with secure boot like rufus, and also create iso from any folder, but i have a problem to show progress with this command :

Start-Process .\source\Dism.exe -argument "/split-image /imagefile:$dism1 /swmfile:$dism2 /filesize:3000 /logpath:.\dism.log" -Wait -PassThru -NoNewWindow

i will change it to start-job, to show progress, and i want i way to get pourcent from dism mode ? any idea ? need read a log file all time ? there is another way to create a uefi boot disk without split dism ? because split wim is very low

Thanks,

Windows for business | Windows Server | User experience | PowerShell
Windows for business | Windows Client for IT Pros | User experience | Other
0 comments No comments
{count} votes

Accepted answer
  1. mehdi dakhama 336 Reputation points MVP
    2020-11-30T20:22:42.58+00:00
    HI Ian,
    not problem, i thought the same things me too, but we can get the progress with way like these :
    
        #declare variable
        $sizedism1 = "p:\sources\install.wim"
        #change dism path with var for your drive for exemple, and don't forget to add * to calculate all file splited
        $sizedism2 = "D:\sources\install*.swm"
    
        #get file source size
        $sizesource = "{0:N2} " -f ((gci $sizedism1   | measure Length -s).sum / 1GB)
        $sizesource = $sizesource -replace (",", ".")
    
        start-job -name  XXX -scriptblock {dism /split-image /imagefile..... }
    
        do {
    
        $result = (get-job XXX).state
    
        $sizedestination = "{0:N2} " -f ((gci $sizedism2 | measure Length -s).sum / 1GB)
    
        $sizedestination = $sizedestination -replace (",", ".")
    
        $a = 100
    
        $pourcent = [int] (($a * $sizedestination) / $sizesource)
    
        write-host $pourcent
    
        sleep -seconds 10
    
        } until ($result -eq 'completed')
    
    0 comments No comments

6 additional answers

Sort by: Most helpful
  1. mehdi dakhama 336 Reputation points MVP
    2020-11-28T21:45:17.017+00:00

    i think i will use my brain and some math, if i cut the file size 5gb to 1gb, i should have 5 1gb .swm files, i will just have to check the size of these at any time files, and recalculate according to the percentage, like 1 file completed 20% of the process etc ...
    what do you think ? and can you help me on it?
    Thank,

    0 comments No comments

  2. mehdi dakhama 336 Reputation points MVP
    2020-11-30T20:32:16.263+00:00

    I was created a free tool, to help community to creat a usb drive bootable, from ISO on UEFI or Bios mode, and also WIM or ESD file systeme
    this is a one of few tool compatible with Secureboot, because a added all signed microsoft dll

    the link to download : https://github.com/dakhama-mehdi/B-B-ISO
    all feedback is welcom

    same picture :

    43767-2020-11-30-17-53-23.png

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.