User Tools

Site Tools


userspace:oracle_virtualbox

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
userspace:oracle_virtualbox [2013/10/17 07:17]
bobzbobz
userspace:oracle_virtualbox [2021/08/23 08:37] (current)
Line 1: Line 1:
-====== Oracle VirtualBox (for OS compatibility) ======+====== Oracle VirtualBox (for OS compatibility problems) ====== 
 +//Scripts and Guide by Soren Birk// 
 This guide describes how to create a shared virtualbox between several users in a Windows domain environment. \\ This guide describes how to create a shared virtualbox between several users in a Windows domain environment. \\
-This guide will use a virtual machine with Windows XP, but it could be anything you like. The purpose of this \\+This guide will use a virtual machine with Windows XP, but it could be any OS you like. The purpose of this \\
 is to have a virtual environment for programs that can’t run on your primary Operating System. is to have a virtual environment for programs that can’t run on your primary Operating System.
  
 The package creates a shortcut on all users’ desktop called “Create VirtualXP”. When someone clicks this icon,\\ The package creates a shortcut on all users’ desktop called “Create VirtualXP”. When someone clicks this icon,\\
- a new shortcut will appear on __that users’ desktop__ called “VirtualXP”. This shortcut loads the shared virtual machine, \\ + a new shortcut will appear on __that users’ desktop__ called “VirtualXP”. This shortcut loads the __shared__ virtual machine, \\ 
-disables auto-update and disables all the default pop-up messages. If the icon has already been clicked, nothing will happen.+disables auto-update and disables all the default pop-up messages.
  
 **Tested With:** **Tested With:**
Line 18: Line 20:
   * Prepare VirtualBox-installer (.msi):   * Prepare VirtualBox-installer (.msi):
     * Start off by downloading VirtualBox for Windows from: https://www.virtualbox.org/wiki/Downloads     * Start off by downloading VirtualBox for Windows from: https://www.virtualbox.org/wiki/Downloads
-    * Open a command prompt and write: VirtualBox-4.3.0-89960-Win.exe –extract+    * Open a command prompt and write: <path-to-file>\VirtualBox-X.X.X-XXXXX-Win.exe –extract
     * You can now find the .msi-file under Appdata → Local → Temp → Virtualbox. You will need both the .msi-file (x64) and the common.cab.      * You can now find the .msi-file under Appdata → Local → Temp → Virtualbox. You will need both the .msi-file (x64) and the common.cab. 
     * Copy them to CLIENT_DATA\VirtualBox     * Copy them to CLIENT_DATA\VirtualBox
   * Prepare the certificate for silent install:   * Prepare the certificate for silent install:
-    * Now you should install the program (just use the .exe-file) – accept the certificate when prompted.+    * You should now install the program (just use the .exe-file) – accept the certificate when prompted.
     * When installed, go to Run… and write certmgr.msc.     * When installed, go to Run… and write certmgr.msc.
-    * Navigate to “trusted publishers” → Right click and browse to Export… - export the certificate as “oraclecert.cer”. +    * Navigate to “trusted publishers” → Right click "Oracle Corporation" and browse to Export… - export the certificate as “oraclecert.cer”. 
     * Copy the certificate to CLIENT_DATA\Certificate     * Copy the certificate to CLIENT_DATA\Certificate
   * Prepare the virtual machine:   * Prepare the virtual machine:
     * Create a new virtual machine in VirtualBox (doesn’t have to be Windows XP – could also be linux ect.) and set it up with the software you like.     * Create a new virtual machine in VirtualBox (doesn’t have to be Windows XP – could also be linux ect.) and set it up with the software you like.
-    * Network could cause problems when you install the package to a new PC if “bridged” mode is set – I use NAT.+    * Network could cause problemswhen you install the package to a new PCif “bridged” mode is set – I use NAT.
     * When the virtual machine is created as you like, shut it down.     * When the virtual machine is created as you like, shut it down.
-    * Copy the VM-folder from <user folder>\VirtualBox VMs to CLIENT_DATA\VMs-folder.+    * Copy the VM-folder from <user folder>\VirtualBox VMs\<VirtualXP> to CLIENT_DATA\VMs-folder.
   * Prepare the user-specific shortcut:   * Prepare the user-specific shortcut:
     * Create a shortcut to your desktop with a path to: "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" startvm VirtualXP.     * Create a shortcut to your desktop with a path to: "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" startvm VirtualXP.
 +    * Create a folder called C:\icons and copy the icon you want for the VirtualXP-shortcut to this folder.
 +    * Finally set the icon for the shortcut.
     * Copy this shortcut to CLIENT_DATA\VMs-folder.     * Copy this shortcut to CLIENT_DATA\VMs-folder.
   * Prepare the .bat-file:   * Prepare the .bat-file:
-    * Create a .bat-file (scroll to bottom) and copy it to CLIENT_DATA\VMs.+    * Create a .bat-file (scroll to the bottom of this guide) and copy it to CLIENT_DATA\VMs.
  
 **Tree:** **Tree:**
Line 60: Line 64:
       ├ VirtualXP.vdi       ├ VirtualXP.vdi
       └ Logs (folder)       └ Logs (folder)
 +</code>
 +
 +//Use Microsoft Orca to get the Msi-ID for the delsub-script.//
 +
 +//Please read through the scripts, as you will need to apply your own domain-specific information.//
 +
 +==== setup.ins ====
 +<code winst>
 +; Author Soren Birk
 +
 +[Actions]
 +requiredWinstVersion >= "4.11.2.6"
 +
 +DefVar $MsiId$
 +DefVar $LogDir$
 +DefVar $ProductId$  
 +DefVar $MinimumSpace$
 +DefVar $InstallDir$
 +DefVar $ExitCode$
 +DefVar $ProfilePath$
 +DefVar $UserProfileName$
 +DefStringList $UserProfileNamesList$
 +
 +set $UserProfileNamesList$ = getOutStreamFromSection ('DosInAnIcon_list_profiledir')
 +
 +Set $LogDir$ = "%SystemDrive%\tmp"
 +
 +; ----------------------------------------------------------------
 +; - Please edit these values                                     -
 +; ----------------------------------------------------------------
 +Set $ProductId$       = "vbox-virtualxp"
 +Set $MinimumSpace$    = "5 GB"
 +Set $InstallDir$      = "%ProgramFiles64Dir%\Oracle\VirtualBox"
 +; ----------------------------------------------------------------
 +
 +if not(HasMinimumSpace ("%SystemDrive%", $MinimumSpace$))
 + LogError "Not enough free space on %SystemDrive%, " + $MinimumSpace$ + " on the drive %SystemDrive% is needed for " + $ProductId$
 + isFatalError "Not enough free space"
 + ; Stop the proces and set installation status as failed
 +else
 + comment "Show product logo"
 + ShowBitmap "%ScriptPath%\vbox-virtualxplogo.png" "VirtualBox - Virtual Windows XP"
 +
 + if FileExists("%ScriptPath%\delsub.ins")
 + comment "Start uninstall sub section"
 + Sub "%ScriptPath%\delsub.ins"
 + endif
 +
 + Message "Installing " + $ProductId$ + " ..."
 +
 + ChangeDirectory "%SCRIPTPATH%"
 +
 + comment "Certificat is being installed"
 + DosInAnIcon_install_cert
 +
 + comment "Start setup-program"
 + Winbatch_install
 +
 + comment "Copying Virtual Machine"
 + Files_install
 +
 + comment "Creating desktop shortcut"
 + LinkFolder_install
 +
 + comment "Setting permissions for Domain Users (VMs)"
 + DosInAnIcon_set_rights
 +
 +endif
 +
 +[DosInAnIcon_install_cert]
 +certutil -addstore "TrustedPublisher" "%ScriptPath%\Certificat\oraclecert.cer"
 +
 +[Winbatch_install]
 +msiexec /i "%ScriptPath%\VirtualBox\VirtualBox-X.X.XX-rXXXXX-MultiArch_amd64.msi" /l* "$LogDir$\$ProductId$.install_log.txt" /qb! ALLUSERS=1 REBOOT=ReallySuppress
 +
 +[Files_install]
 +copy -s "%ScriptPath%\VMs\*.*" "%Systemdrive%\VMs\"
 +; copying icons also
 +copy -s "%ScriptPath%\icons\*.*" "%Systemdrive%\icons\"
 +
 +[LinkFolder_install]
 +set_basefolder common_desktopdirectory
 +set_subfolder ""
 +; deleting standard shortcut
 +delete_element "Oracle VM VirtualBox"
 +; creating new shortcut
 +set_link
 + name: "Create VirtualXP"
 + target: "%Systemdrive%\VMs\Create_VirtualXP.bat"
 + parameters: 
 + working_dir: 
 + icon_file: "%Systemdrive%\icons\registericon.ico"
 + icon_index: 
 +end_link
 +
 +[DosInAnIcon_set_rights]
 +cacls C:\VMs /E /T /C /G "<yourdomain>\Domain Users":C
 +
 +[DosInAnIcon_list_profiledir]
 +@echo off
 +dir "%Systemdrive%\Users" /b /ad
 +
 +[Files_uninstall2]
 +del -sf "%Systemdrive%\Users\$UserProfileName$\Desktop\VirtualXP.lnk"
 +
 +[Sub_check_exitcode]
 +comment "Test for installation success via exit code"
 +set $ExitCode$ = getLastExitCode
 +; informations to exit codes see
 +; http://msdn.microsoft.com/en-us/library/aa372835(VS.85).aspx
 +; http://msdn.microsoft.com/en-us/library/aa368542.aspx
 +if ($ExitCode$ = "0")
 + comment "Looks good: setup program gives exitcode zero"
 +else
 + comment "Setup program gives a exitcode unequal zero: " + $ExitCode$
 + if ($ExitCode$ = "1605")
 + comment "ERROR_UNKNOWN_PRODUCT 1605 This action is only valid for products that are currently installed."
 + comment "Uninstall of a not installed product failed - no problem"
 + else
 + if ($ExitCode$ = "1641")
 + comment "looks good: setup program gives exitcode 1641"
 + comment "ERROR_SUCCESS_REBOOT_INITIATED 1641 The installer has initiated a restart. This message is indicative of a success."
 + else
 + if ($ExitCode$ = "3010")
 + comment "looks good: setup program gives exitcode 3010"
 + comment "ERROR_SUCCESS_REBOOT_REQUIRED 3010 A restart is required to complete the install. This message is indicative of a success."
 + else
 + logError "Fatal: Setup program gives an unknown exitcode unequal zero: " + $ExitCode$
 + isFatalError
 + endif
 + endif
 + endif
 +endif
 +</code>
 +
 +==== uninstall.ins ====
 +<code winst>
 +; Author Soren Birk
 +
 +[Actions]
 +requiredWinstVersion >= "4.11.2.6"
 +
 +DefVar $MsiId$
 +DefVar $LogDir$
 +DefVar $ExitCode$
 +DefVar $ProductId$
 +DefVar $InstallDir$
 +DefVar $ProfilePath$
 +DefVar $UserProfileName$
 +DefStringList $UserProfileNamesList$
 +
 +set $UserProfileNamesList$ = getOutStreamFromSection ('DosInAnIcon_list_profiledir')
 +
 +Set $LogDir$ = "%SystemDrive%\tmp"
 +
 +; ----------------------------------------------------------------
 +; - Please edit these values                                     -
 +; ----------------------------------------------------------------
 +Set $ProductId$       = "vbox-virtualxp"
 +Set $InstallDir$      = "%ProgramFiles64Dir%\Oracle\VirtualBox"
 +; ----------------------------------------------------------------
 +
 +
 +comment "Show product logo"
 +ShowBitmap "%ScriptPath%\vbox-virtualxplogo.png" "VirtualBox - Virtual Windows XP"
 +
 +Message "Uninstalling " + $ProductId$ + " ..."
 +
 +if FileExists("%ScriptPath%\delsub.ins")
 + comment "Start uninstall sub section"
 + Sub "%ScriptPath%\delsub.ins"
 +endif
 +
 +[DosInAnIcon_list_profiledir]
 +@echo off
 +dir "%Systemdrive%\Users" /b /ad
 +
 +[Files_uninstall2]
 +del -sf "%Systemdrive%\Users\$UserProfileName$\Desktop\VirtualXP.lnk"
 +</code>
 +
 +==== delsub.ins ====
 +<code winst>
 +; Author Soren Birk
 +
 +
 +Set $MsiId$ = '{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}'
 +
 +
 +Message "Uninstalling " + $ProductId$ + " ..."
 +
 +if not (GetRegistryStringValue64("[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" + $MsiId$ + "] DisplayName") = "")
 + comment "MSI id " + $MsiId$ + " found in registry, starting uninstall"
 + Winbatch_uninstall_msi
 + sub_check_exitcode
 +endif
 +
 +comment "Deleting files"
 +Files_uninstall
 +
 +comment "Deleting shortcuts"
 +LinkFolder_uninstall
 +
 +
 +for %prof% in $UserProfileNamesList$ do Sub_check_user
 +
 +
 +[Winbatch_uninstall_msi]
 +msiexec /x $MsiId$ /qb! REBOOT=ReallySuppress
 +
 +[Files_uninstall]
 +del -sf "$InstallDir$\"
 +del -sf "%Systemdrive%\VMs\VirtualXP\"
 +
 +[LinkFolder_uninstall]
 +set_basefolder common_desktopdirectory
 +set_subfolder ""
 +delete_element "Create VirtualXP"
 +
 +[Sub_check_user]
 +Set $UserProfileName$ = "%prof%"
 +if not ($UserProfileName$ = "") and not ($UserProfileName$ = "All Users") and not ($UserProfileName$ = "Public") and not ($UserProfileName$ = "LocalService") and not ($UserProfileName$ = "NetworkService")
 + if FileExists("%Systemdrive%\Users\%prof%\Desktop\VirtualXP.lnk")
 + Files_uninstall2
 + endif
 +endif
 +
 +[Sub_check_exitcode]
 +comment "Test for installation success via exit code"
 +set $ExitCode$ = getLastExitCode
 +; informations to exit codes see
 +; http://msdn.microsoft.com/en-us/library/aa372835(VS.85).aspx
 +; http://msdn.microsoft.com/en-us/library/aa368542.aspx
 +if ($ExitCode$ = "0")
 + comment "Looks good: setup program gives exitcode zero"
 +else
 + comment "Setup program gives a exitcode unequal zero: " + $ExitCode$
 + if ($ExitCode$ = "1605")
 + comment "ERROR_UNKNOWN_PRODUCT 1605 This action is only valid for products that are currently installed."
 + comment "Uninstall of a not installed product failed - no problem"
 + else
 + if ($ExitCode$ = "1641")
 + comment "looks good: setup program gives exitcode 1641"
 + comment "ERROR_SUCCESS_REBOOT_INITIATED 1641 The installer has initiated a restart. This message is indicative of a success."
 + else
 + if ($ExitCode$ = "3010")
 + comment "looks good: setup program gives exitcode 3010"
 + comment "ERROR_SUCCESS_REBOOT_REQUIRED 3010 A restart is required to complete the install. This message is indicative of a success."
 + else
 + logError "Fatal: Setup program gives an unknown exitcode unequal zero: " + $ExitCode$
 + isFatalError
 + endif
 + endif
 + endif
 +endif
 +</code>
 +
 +==== Create_VirtualXP.bat ====
 +<code dos>
 +"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" registervm C:\VMs\VirtualXP\VirtualXP.vbox
 +"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" setextradata global GUI/UpdateDate never
 +"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" setextradata global GUI/SuppressMessages remindAboutAutoCapture,remindAboutMouseIntegrationOn,showRuntimeError.warning.HostAudioNotResponding,remindAboutGoingSeamless,remindAboutInputCapture,remindAboutGoingFullscreen,remindAboutMouseIntegrationOff,confirmGoingSeamless,confirmInputCapture,remindAboutPausedVMInput,confirmVMReset,confirmGoingFullscreen,remindAboutWrongColorDepth
 +xcopy "C:\VMs\VirtualXP.lnk" "C:\Users\%username%\Desktop\" /Y
 +msg * "VirtualXP can now be found as a desktop shortcut"
 </code> </code>
userspace/oracle_virtualbox.1381994227.txt.gz · Last modified: 2021/08/23 08:37 (external edit)