|
@@ -0,0 +1,40 @@
|
|
|
|
|
+
|
|
|
|
|
+Import-Module -Name $env:PSLIB
|
|
|
|
|
+
|
|
|
|
|
+Function Main()
|
|
|
|
|
+{
|
|
|
|
|
+ if ($env:VBOX_INSTALL_PATH -ne $null){
|
|
|
|
|
+ $VBOXMANAGE = $env:VBOX_INSTALL_PATH + "VBoxManage.exe"
|
|
|
|
|
+ } elseif ($env:VBOX_MSI_INSTALL_PATH -ne $null){
|
|
|
|
|
+ $VBOXMANAGE = $env:VBOX_MSI_INSTALL_PATH + "VBoxManage.exe"
|
|
|
|
|
+ } else {
|
|
|
|
|
+ $dialog = @"
|
|
|
|
|
+VirtualBox install Path not found!
|
|
|
|
|
+
|
|
|
|
|
+Is VirtualBox installed?
|
|
|
|
|
+"@
|
|
|
|
|
+ $dialog
|
|
|
|
|
+ GuiMessageBox $dialog -Buttons "Ok"
|
|
|
|
|
+ Break
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ "Select VDI File..."
|
|
|
|
|
+
|
|
|
|
|
+ $inname = GuiOpenFileName -Filter "Virtualbox Images (*.vdi)| *.vdi"
|
|
|
|
|
+
|
|
|
|
|
+ if (($inname -eq $null) -or ($inname -eq "")){
|
|
|
|
|
+ "No input file selected"
|
|
|
|
|
+ Break
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ &$VBOXMANAGE modifymedium disk $inname --compact
|
|
|
|
|
+
|
|
|
|
|
+ if($LASTEXITCODE -eq 0){
|
|
|
|
|
+ GuiMessageBox "Success" -Buttons "Ok"
|
|
|
|
|
+ } else {
|
|
|
|
|
+ GuiMessageBox "Error" -Buttons "Ok"
|
|
|
|
|
+ }
|
|
|
|
|
+ Break
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+Main
|