[Main]
Title=Unmount WIM files
Type=script
Level=10
Description=
Selected=False
Download_Level=2
Author=NightMan
Download_Level=2

[Process]
ReadENV
If,"%SourceType%",Equal,"",run,%ScriptFile%,NotConfigured
If,"%SourceType%",Equal,"VistaCD",run,%ScriptFile%,UnMountVista
If,"%SourceType%",Equal,"WAIK",run,%ScriptFile%,UnMountWAIK

[UnMountVista]
If,"%WimTools%",Equal,"ImageX",run,%ScriptFile%,UnMountVistaImageX
If,"%WimTools%",Equal,"WimUtil",run,%ScriptFile%,UnMountVistaWimUtil

[UnMountWAIK]
If,"%WimTools%",Equal,"ImageX",run,%ScriptFile%,UnMountWAIKImageX
If,"%WimTools%",Equal,"WimUtil",run,%ScriptFile%,UnMountWAIKWimUtil

[UnMountWAIKWimUtil]
Echo,"UnMounting WAIK files with wimutil.exe..."
ShellExecute,Hide,"#$q%tools%\wimutil.exe#$q","unmount #$q%BootSRC%#$q"

[UnMountWAIKImageX]
Echo,"UnMounting WAIK files with imagex.exe..."
ShellExecute,Hide,"#$q%IMAGEX%#$q","/unmount #$q%BootSRC%#$q"

[UnMountVistaWimUtil]
Echo,"UnMounting Windows Vista files with wimutil.exe..."
ShellExecute,Hide,"#$q%tools%\wimutil.exe#$q","unmount #$q%BootSRC%#$q"
ShellExecute,Hide,"#$q%tools%\wimutil.exe#$q","unmount #$q%InstallSRC%#$q"

[UnMountVistaImageX]
Echo,"UnMounting Windows Vista files with imagex.exe..."
ShellExecute,Hide,"#$q%IMAGEX%#$q","/unmount #$q%BootSRC%#$q"
ShellExecute,Hide,"#$q%IMAGEX%#$q","/unmount #$q%InstallSRC%#$q"

[NotConfigured]
Message,"Please run PreConfig script. Exiting..."
exit,"Exiting.."

