Dism split : show progress

Dernière mise à jour : août 31


When you use the command "DISM /Split image" to splti a .wim file into several .swm files, it will take a long time, and this command does not show the percentage or the progress state wich can be cumbersome.

We are going to discover a method using workflows to gain fluidity and time

Solution :

#declare variable : enter the path for your source
    $sizedismsource = "p:\sources\install.wim"
#replace dism path with destination to split, and don't forget to add * to calculate all file splited
    $sizedismdestination = "D:\sources\install*.swm"
#get file source size
    $sizesource = "{0:N2} " -f ((gci $sizedismsource | measure Length -s).sum / 1GB)
    $sizesource = $sizesource -replace (",", ".")
    #Create a background job with a name in our exemple we have chose (progress-split)
 start-job -name 'progress-split' -scriptblock {dism /split-image /imagefile:$using:sizedismsource  /SWMfile:$using:sizedismdestination /FileSize:3500 }
    do {
    $result = (get-job 'progress-split').state
    $sizedestination = "{0:N2} " -f ((gci $sizedismdestination | measure Length -s).sum / 1GB)
    $sizedestination = $sizedestination -replace (",", ".")
    $a = 100
    $progress = [int] (($a * $sizedestination) / $sizesource)
    write-output $progress
   if ($result -ne 'completed') {
    sleep -seconds 10
    } until ($result -eq 'completed')

write-output "split files is complet"
remove-job 'progress-split'

13 vues0 commentaire

Posts récents

Voir tout