#Add your own variables below
$UpdatesPath = "D:\WIM\wsusoffline108\wsusoffline\client\w61\glb\*" #Path to the offline updates folder for the image OS
$MountPath = "D:\WIM\Mounted" #Temporary image mount folder
$WimFile = "D:\WIM\Original\Win7x86\Win7x86.wim" #Source of image WIM file
$IndexNumber = "1" #Image Index Number
#Start of WIM mount process
DISM /Mount-Wim /WimFile:$WimFile /index:$IndexNumber /Mountdir:$MountPath
#Start of updates injection
$UpdateArray = Get-Item $UpdatesPath
ForEach ($Updates in $UpdateArray)
{
DISM /image:$MountPath /Add-Package /Packagepath:$Updates
Start-Sleep s 10
}
Write-Host "Updates Applied to Mount Image"
#Start of space saving on mounted image
DISM /online /Cleanup-Image /StartComponentCleanup
DISM /online /Cleanup-Image /StartComponentCleanup /ResetBase
DISM /online /Cleanup-Image /SPSuperseded
Write-Host "Image Space Saving Completed"
#Start of unmount of mounted WIM file
DISM /Unmount-Wim /Mountdir:$MountPath /commit
#Start of cleanup on WIM file
DISM /Cleanup-Wim