This shows you the differences between two versions of the page.
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 |
+ | //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 | + | 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 | + | a new shortcut will appear on __that users’ desktop__ called “VirtualXP”. This shortcut loads the __shared__ |
- | 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:// | * Start off by downloading VirtualBox for Windows from: https:// | ||
- | * Open a command prompt and write: VirtualBox-4.3.0-89960-Win.exe –extract | + | * Open a command prompt and write: |
* 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 |
* 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 " |
* 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 problems, when you install the package to a new PC, if “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> | + | * Copy the VM-folder from <user folder> |
* Prepare the user-specific shortcut: | * Prepare the user-specific shortcut: | ||
* Create a shortcut to your desktop with a path to: " | * Create a shortcut to your desktop with a path to: " | ||
+ | * 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 |
**Tree:** | **Tree:** | ||
Line 60: | Line 64: | ||
├ VirtualXP.vdi | ├ VirtualXP.vdi | ||
└ Logs (folder) | └ Logs (folder) | ||
+ | </ | ||
+ | |||
+ | //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 >= " | ||
+ | |||
+ | DefVar $MsiId$ | ||
+ | DefVar $LogDir$ | ||
+ | DefVar $ProductId$ | ||
+ | DefVar $MinimumSpace$ | ||
+ | DefVar $InstallDir$ | ||
+ | DefVar $ExitCode$ | ||
+ | DefVar $ProfilePath$ | ||
+ | DefVar $UserProfileName$ | ||
+ | DefStringList $UserProfileNamesList$ | ||
+ | |||
+ | set $UserProfileNamesList$ = getOutStreamFromSection (' | ||
+ | |||
+ | Set $LogDir$ = " | ||
+ | |||
+ | ; ---------------------------------------------------------------- | ||
+ | ; - Please edit these values | ||
+ | ; ---------------------------------------------------------------- | ||
+ | Set $ProductId$ | ||
+ | Set $MinimumSpace$ | ||
+ | Set $InstallDir$ | ||
+ | ; ---------------------------------------------------------------- | ||
+ | |||
+ | if not(HasMinimumSpace (" | ||
+ | LogError "Not enough free space on %SystemDrive%, | ||
+ | isFatalError "Not enough free space" | ||
+ | ; Stop the proces and set installation status as failed | ||
+ | else | ||
+ | comment "Show product logo" | ||
+ | ShowBitmap " | ||
+ | |||
+ | if FileExists(" | ||
+ | comment "Start uninstall sub section" | ||
+ | Sub " | ||
+ | endif | ||
+ | |||
+ | Message " | ||
+ | |||
+ | ChangeDirectory " | ||
+ | |||
+ | comment " | ||
+ | DosInAnIcon_install_cert | ||
+ | |||
+ | comment "Start setup-program" | ||
+ | Winbatch_install | ||
+ | |||
+ | comment " | ||
+ | Files_install | ||
+ | |||
+ | comment " | ||
+ | LinkFolder_install | ||
+ | |||
+ | comment " | ||
+ | DosInAnIcon_set_rights | ||
+ | |||
+ | endif | ||
+ | |||
+ | [DosInAnIcon_install_cert] | ||
+ | certutil -addstore " | ||
+ | |||
+ | [Winbatch_install] | ||
+ | msiexec /i " | ||
+ | |||
+ | [Files_install] | ||
+ | copy -s " | ||
+ | ; copying icons also | ||
+ | copy -s " | ||
+ | |||
+ | [LinkFolder_install] | ||
+ | set_basefolder common_desktopdirectory | ||
+ | set_subfolder "" | ||
+ | ; deleting standard shortcut | ||
+ | delete_element " | ||
+ | ; creating new shortcut | ||
+ | set_link | ||
+ | name: " | ||
+ | target: " | ||
+ | parameters: | ||
+ | working_dir: | ||
+ | icon_file: " | ||
+ | icon_index: | ||
+ | end_link | ||
+ | |||
+ | [DosInAnIcon_set_rights] | ||
+ | cacls C:\VMs /E /T /C /G "< | ||
+ | |||
+ | [DosInAnIcon_list_profiledir] | ||
+ | @echo off | ||
+ | dir " | ||
+ | |||
+ | [Files_uninstall2] | ||
+ | del -sf " | ||
+ | |||
+ | [Sub_check_exitcode] | ||
+ | comment "Test for installation success via exit code" | ||
+ | set $ExitCode$ = getLastExitCode | ||
+ | ; informations to exit codes see | ||
+ | ; http:// | ||
+ | ; http:// | ||
+ | if ($ExitCode$ = " | ||
+ | comment "Looks good: setup program gives exitcode zero" | ||
+ | else | ||
+ | comment "Setup program gives a exitcode unequal zero: " + $ExitCode$ | ||
+ | if ($ExitCode$ = " | ||
+ | comment " | ||
+ | comment " | ||
+ | else | ||
+ | if ($ExitCode$ = " | ||
+ | comment "looks good: setup program gives exitcode 1641" | ||
+ | comment " | ||
+ | else | ||
+ | if ($ExitCode$ = " | ||
+ | comment "looks good: setup program gives exitcode 3010" | ||
+ | comment " | ||
+ | else | ||
+ | logError " | ||
+ | isFatalError | ||
+ | endif | ||
+ | endif | ||
+ | endif | ||
+ | endif | ||
+ | </ | ||
+ | |||
+ | ==== uninstall.ins ==== | ||
+ | <code winst> | ||
+ | ; Author Soren Birk | ||
+ | |||
+ | [Actions] | ||
+ | requiredWinstVersion >= " | ||
+ | |||
+ | DefVar $MsiId$ | ||
+ | DefVar $LogDir$ | ||
+ | DefVar $ExitCode$ | ||
+ | DefVar $ProductId$ | ||
+ | DefVar $InstallDir$ | ||
+ | DefVar $ProfilePath$ | ||
+ | DefVar $UserProfileName$ | ||
+ | DefStringList $UserProfileNamesList$ | ||
+ | |||
+ | set $UserProfileNamesList$ = getOutStreamFromSection (' | ||
+ | |||
+ | Set $LogDir$ = " | ||
+ | |||
+ | ; ---------------------------------------------------------------- | ||
+ | ; - Please edit these values | ||
+ | ; ---------------------------------------------------------------- | ||
+ | Set $ProductId$ | ||
+ | Set $InstallDir$ | ||
+ | ; ---------------------------------------------------------------- | ||
+ | |||
+ | |||
+ | comment "Show product logo" | ||
+ | ShowBitmap " | ||
+ | |||
+ | Message " | ||
+ | |||
+ | if FileExists(" | ||
+ | comment "Start uninstall sub section" | ||
+ | Sub " | ||
+ | endif | ||
+ | |||
+ | [DosInAnIcon_list_profiledir] | ||
+ | @echo off | ||
+ | dir " | ||
+ | |||
+ | [Files_uninstall2] | ||
+ | del -sf " | ||
+ | </ | ||
+ | |||
+ | ==== delsub.ins ==== | ||
+ | <code winst> | ||
+ | ; Author Soren Birk | ||
+ | |||
+ | |||
+ | Set $MsiId$ = ' | ||
+ | |||
+ | |||
+ | Message " | ||
+ | |||
+ | if not (GetRegistryStringValue64(" | ||
+ | comment "MSI id " + $MsiId$ + " found in registry, starting uninstall" | ||
+ | Winbatch_uninstall_msi | ||
+ | sub_check_exitcode | ||
+ | endif | ||
+ | |||
+ | comment " | ||
+ | Files_uninstall | ||
+ | |||
+ | comment " | ||
+ | LinkFolder_uninstall | ||
+ | |||
+ | |||
+ | for %prof% in $UserProfileNamesList$ do Sub_check_user | ||
+ | |||
+ | |||
+ | [Winbatch_uninstall_msi] | ||
+ | msiexec /x $MsiId$ /qb! REBOOT=ReallySuppress | ||
+ | |||
+ | [Files_uninstall] | ||
+ | del -sf " | ||
+ | del -sf " | ||
+ | |||
+ | [LinkFolder_uninstall] | ||
+ | set_basefolder common_desktopdirectory | ||
+ | set_subfolder "" | ||
+ | delete_element " | ||
+ | |||
+ | [Sub_check_user] | ||
+ | Set $UserProfileName$ = " | ||
+ | if not ($UserProfileName$ = "" | ||
+ | if FileExists(" | ||
+ | Files_uninstall2 | ||
+ | endif | ||
+ | endif | ||
+ | |||
+ | [Sub_check_exitcode] | ||
+ | comment "Test for installation success via exit code" | ||
+ | set $ExitCode$ = getLastExitCode | ||
+ | ; informations to exit codes see | ||
+ | ; http:// | ||
+ | ; http:// | ||
+ | if ($ExitCode$ = " | ||
+ | comment "Looks good: setup program gives exitcode zero" | ||
+ | else | ||
+ | comment "Setup program gives a exitcode unequal zero: " + $ExitCode$ | ||
+ | if ($ExitCode$ = " | ||
+ | comment " | ||
+ | comment " | ||
+ | else | ||
+ | if ($ExitCode$ = " | ||
+ | comment "looks good: setup program gives exitcode 1641" | ||
+ | comment " | ||
+ | else | ||
+ | if ($ExitCode$ = " | ||
+ | comment "looks good: setup program gives exitcode 3010" | ||
+ | comment " | ||
+ | else | ||
+ | logError " | ||
+ | isFatalError | ||
+ | endif | ||
+ | endif | ||
+ | endif | ||
+ | endif | ||
+ | </ | ||
+ | |||
+ | ==== Create_VirtualXP.bat ==== | ||
+ | <code dos> | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | xcopy " | ||
+ | msg * " | ||
</ | </ |