This shows you the differences between two versions of the page.
userspace:oracle_virtualbox [2013/10/17 07:33] bobzbobz |
userspace:oracle_virtualbox [2021/08/23 08:37] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== 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 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. | ||
- | |||
- | 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, \\ | ||
- | disables auto-update and disables all the default pop-up messages. If the icon has already been clicked, nothing will happen. | ||
- | |||
- | **Tested With:** | ||
- | * OPSI 4.0.2.4 | ||
- | * Winst 4.11.3.3 | ||
- | * Windows 7, 64-Bit | ||
- | |||
- | **Instructions: | ||
- | |||
- | Okay, this package is not that easy and you will need to do some preparations for it to work. | ||
- | * Prepare VirtualBox-installer (.msi): | ||
- | * Start off by downloading VirtualBox for Windows from: https:// | ||
- | * Open a command prompt and write: VirtualBox-4.3.0-89960-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. | ||
- | * Copy them to CLIENT_DATA\VirtualBox | ||
- | * Prepare the certificate for silent install: | ||
- | * Now you should install the program (just use the .exe-file) – accept the certificate when prompted. | ||
- | * 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”. | ||
- | * Copy the certificate to CLIENT_DATA\Certificate | ||
- | * 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. | ||
- | * 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. | ||
- | * Copy the VM-folder from <user folder> | ||
- | * Prepare the user-specific shortcut: | ||
- | * 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. | ||
- | * Prepare the .bat-file: | ||
- | * Create a .bat-file (scroll to bottom) and copy it to CLIENT_DATA\VMs. | ||
- | |||
- | **Tree:** | ||
- | < | ||
- | CLIENT_DATA | ||
- | ├ setup.ins | ||
- | ├ uninstall.ins | ||
- | ├ delsub.ins | ||
- | ├ vbox-virtualxplogo.png | ||
- | ├ Certificate | ||
- | │ └ oraclecert.cer | ||
- | ├ Icons | ||
- | │ ├ registericon.ico | ||
- | │ └ virtualxpicon.ico | ||
- | ├ VirtualBox | ||
- | │ ├ common.cab | ||
- | │ └ VirtualBox-X.X.XX-rXXXXX-MultiArch_amd64.msi | ||
- | └ VMs | ||
- | ├ VirtualXp(.lnk) | ||
- | ├ Create_VirtualXP.bat | ||
- | └ VirtualXP | ||
- | ├ VirtualXP.vbox | ||
- | ├ VirtualXP.vbox-prev | ||
- | ├ VirtualXP.vdi | ||
- | └ Logs (folder) | ||
- | </ | ||
- | |||
- | Use Microsoft Orca to get the Msi-ID for the delsub-script. | ||
- | |||
- | ==== 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 installationstatus 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 /32Bit | ||
- | |||
- | 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 * " | ||
- | </ |