├── .gitignore ├── LICENSE ├── README.md ├── backup.bat ├── install.bat ├── ovr.bat └── uninstall.bat /.gitignore: -------------------------------------------------------------------------------- 1 | appdata 2 | Oculus 3 | registry 4 | hosts -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 drosoCode 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Offculus 2 | Scripts to create offline installer for Oculus Rift 3 | 4 | ## Creation 5 | - Install Oculus Software, login and configure your headset (you need a functionnal installation for the creation of the installer) 6 | - Download this project and execute backup.bat (this will backup the Oculus Software and your user and headset data) 7 | - The installer is ready (you can copy the whole folder to a safe place) 8 | 9 | ## Usage 10 | - This installer is intended for Steam VR use, so Oculus Library will not work out of the box (the OVRLibrary service is not installed) 11 | - To use the offline installer, execute the install.bat (this will install the oculus software, drivers and services and will block communication with facebook servers) 12 | - If you chose to modify the install path, make sure that you add a final "\\", for instance enter "D:\Programs\Oculus\\" 13 | - To block the oculus/facebook services the installer edits the hosts system file, so you may need to add a security exception in Windows Defender 14 | - By default the OVRService startup is set to manual, you can use the ovr.bat file to easily start and stop it 15 | 16 | ## Uninstallation 17 | - Run the uninstall.bat script 18 | -------------------------------------------------------------------------------- /backup.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | :: https://stackoverflow.com/questions/1894967/how-to-request-administrator-access-inside-a-batch-file 4 | :: BatchGotAdmin 5 | :------------------------------------- 6 | REM --> Check for permissions 7 | IF "%PROCESSOR_ARCHITECTURE%" EQU "amd64" ( 8 | >nul 2>&1 "%SYSTEMROOT%\SysWOW64\cacls.exe" "%SYSTEMROOT%\SysWOW64\config\system" 9 | ) ELSE ( 10 | >nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system" 11 | ) 12 | 13 | REM --> If error flag set, we do not have admin. 14 | if '%errorlevel%' NEQ '0' ( 15 | echo Requesting administrative privileges... 16 | goto UACPrompt 17 | ) else ( goto gotAdmin ) 18 | 19 | :UACPrompt 20 | echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs" 21 | set params= %* 22 | echo UAC.ShellExecute "cmd.exe", "/c ""%~s0"" %params:"=""%", "", "runas", 1 >> "%temp%\getadmin.vbs" 23 | 24 | "%temp%\getadmin.vbs" 25 | del "%temp%\getadmin.vbs" 26 | exit /B 27 | 28 | :gotAdmin 29 | pushd "%CD%" 30 | CD /D "%~dp0" 31 | :-------------------------------------- 32 | 33 | :: Get oculus install dir from the registry 34 | FOR /F "usebackq tokens=3*" %%A IN (`REG QUERY "HKLM\SOFTWARE\WOW6432Node\Oculus VR, LLC\Oculus" /v Base`) DO ( 35 | set oculusdir=%%A %%B 36 | ) 37 | :: Remove blank space at the end, if present 38 | if "%oculusdir:~-1%" EQU " " ( 39 | set oculusdir=%oculusdir:~0,-1% 40 | ) 41 | :: Copy Oculus software 42 | Xcopy /E "%oculusdir%." "%cd%\Oculus\" /y 43 | :: Backup AppData 44 | Xcopy /E "%appdata%\..\Local\Oculus" "%cd%\appdata\Local\Oculus\" /y 45 | Xcopy /E "%appdata%\Oculus" "%cd%\appdata\Roaming\Oculus\" /y 46 | :: Backup Registry entries 47 | mkdir "%cd%\registry" 48 | reg export "HKLM\SOFTWARE\WOW6432Node\Oculus VR, LLC" "%cd%\registry\oculus.reg" 49 | reg export "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Oculus" "%cd%\registry\uninstall.reg" 50 | 51 | PAUSE -------------------------------------------------------------------------------- /install.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | :: https://stackoverflow.com/questions/1894967/how-to-request-administrator-access-inside-a-batch-file 4 | :: BatchGotAdmin 5 | :------------------------------------- 6 | REM --> Check for permissions 7 | IF "%PROCESSOR_ARCHITECTURE%" EQU "amd64" ( 8 | >nul 2>&1 "%SYSTEMROOT%\SysWOW64\cacls.exe" "%SYSTEMROOT%\SysWOW64\config\system" 9 | ) ELSE ( 10 | >nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system" 11 | ) 12 | 13 | REM --> If error flag set, we do not have admin. 14 | if '%errorlevel%' NEQ '0' ( 15 | echo Requesting administrative privileges... 16 | goto UACPrompt 17 | ) else ( goto gotAdmin ) 18 | 19 | :UACPrompt 20 | echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs" 21 | set params= %* 22 | echo UAC.ShellExecute "cmd.exe", "/c ""%~s0"" %params:"=""%", "", "runas", 1 >> "%temp%\getadmin.vbs" 23 | 24 | "%temp%\getadmin.vbs" 25 | del "%temp%\getadmin.vbs" 26 | exit /B 27 | 28 | :gotAdmin 29 | pushd "%CD%" 30 | CD /D "%~dp0" 31 | :-------------------------------------- 32 | 33 | :: Restore registry entries 34 | regedit /s "%cd%\registry\oculus.reg" 35 | regedit /s "%cd%\registry\uninstall.reg" 36 | :: Get install dir from registry 37 | FOR /F "usebackq tokens=3*" %%A IN (`REG QUERY "HKLM\SOFTWARE\WOW6432Node\Oculus VR, LLC\Oculus" /v Base`) DO ( 38 | set oculusdir=%%A %%B 39 | ) 40 | :: Remove blank space at the end, if present 41 | if "%oculusdir:~-1%" EQU " " ( 42 | set oculusdir=%oculusdir:~0,-1% 43 | ) 44 | :: Ask for install dir 45 | set /p installpath="Install Path [ENTER for %oculusdir%]:" 46 | if "%installpath%" EQU "" ( 47 | set installpath=%oculusdir% 48 | ) else ( 49 | :: If not default install dir, replace install dir in registry 50 | reg add "HKLM\SOFTWARE\WOW6432Node\Oculus VR, LLC\Oculus" /t REG_SZ /v Base /f /d "%installpath%\" 51 | reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Oculus" /t REG_EXPAND_SZ /v DisplayIcon /f /d "%installpath%OculusSetup.exe" 52 | reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Oculus" /t REG_EXPAND_SZ /v InstallLocation /f /d "%installpath%\" 53 | reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Oculus" /t REG_EXPAND_SZ /v ModifyPath /f /d "%installpath%OculusSetup.exe /repair" 54 | reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Oculus" /t REG_EXPAND_SZ /v UninstallString /f /d "%installpath%OculusSetup.exe /uninstall" 55 | ) 56 | :: Copy Oculus software 57 | Xcopy /E "%cd%\Oculus" "%installpath%" /y 58 | :: Restore AppData backup 59 | Xcopy /E "%cd%\appdata\Local\Oculus" "%appdata%\..\Local\Oculus\" /y 60 | Xcopy /E "%cd%\appdata\Roaming\Oculus" "%appdata%\Oculus\" /y 61 | :: Install Drivers 62 | "%installpath%Support\oculus-drivers\oculus-driver.exe" 63 | :: Add Environment Variables 64 | setx /M PATH "%PATH%;%installpath%Support\oculus-runtime" 65 | setx /M OculusBase "%installpath%\" 66 | :: Install OVRService 67 | "%installpath%Support\oculus-runtime\OVRServiceLauncher.exe" -install -start 68 | :: Set OVRService start to manual 69 | sc config OVRService start=demand 70 | :: Backup hosts file 71 | copy "%windir%\System32\drivers\etc\hosts" "%cd%\hosts" 72 | :: Block facebook and oculus services 73 | echo 127.0.0.1 graph.oculus.com >> "%windir%\System32\drivers\etc\hosts" 74 | echo 127.0.0.1 edge-mqtt.facebook.com >> "%windir%\System32\drivers\etc\hosts" 75 | echo 127.0.0.1 scontent.oculuscdn.com >> "%windir%\System32\drivers\etc\hosts" 76 | echo 127.0.0.1 securecdn.oculus.com >> "%windir%\System32\drivers\etc\hosts" 77 | echo 127.0.0.1 graph.facebook.com >> "%windir%\System32\drivers\etc\hosts" 78 | 79 | PAUSE -------------------------------------------------------------------------------- /ovr.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | :: https://stackoverflow.com/questions/1894967/how-to-request-administrator-access-inside-a-batch-file 4 | :: BatchGotAdmin 5 | :------------------------------------- 6 | REM --> Check for permissions 7 | IF "%PROCESSOR_ARCHITECTURE%" EQU "amd64" ( 8 | >nul 2>&1 "%SYSTEMROOT%\SysWOW64\cacls.exe" "%SYSTEMROOT%\SysWOW64\config\system" 9 | ) ELSE ( 10 | >nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system" 11 | ) 12 | 13 | REM --> If error flag set, we do not have admin. 14 | if '%errorlevel%' NEQ '0' ( 15 | echo Requesting administrative privileges... 16 | goto UACPrompt 17 | ) else ( goto gotAdmin ) 18 | 19 | :UACPrompt 20 | echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs" 21 | set params= %* 22 | echo UAC.ShellExecute "cmd.exe", "/c ""%~s0"" %params:"=""%", "", "runas", 1 >> "%temp%\getadmin.vbs" 23 | 24 | "%temp%\getadmin.vbs" 25 | del "%temp%\getadmin.vbs" 26 | exit /B 27 | 28 | :gotAdmin 29 | pushd "%CD%" 30 | CD /D "%~dp0" 31 | :-------------------------------------- 32 | 33 | sc query "OVRService" | findstr "RUNNING" 34 | if %ERRORLEVEL% == 1 ( 35 | sc start OVRService 36 | ) else ( 37 | sc stop OVRService 38 | ) 39 | -------------------------------------------------------------------------------- /uninstall.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | :: https://stackoverflow.com/questions/1894967/how-to-request-administrator-access-inside-a-batch-file 4 | :: BatchGotAdmin 5 | :------------------------------------- 6 | REM --> Check for permissions 7 | IF "%PROCESSOR_ARCHITECTURE%" EQU "amd64" ( 8 | >nul 2>&1 "%SYSTEMROOT%\SysWOW64\cacls.exe" "%SYSTEMROOT%\SysWOW64\config\system" 9 | ) ELSE ( 10 | >nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system" 11 | ) 12 | 13 | REM --> If error flag set, we do not have admin. 14 | if '%errorlevel%' NEQ '0' ( 15 | echo Requesting administrative privileges... 16 | goto UACPrompt 17 | ) else ( goto gotAdmin ) 18 | 19 | :UACPrompt 20 | echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs" 21 | set params= %* 22 | echo UAC.ShellExecute "cmd.exe", "/c ""%~s0"" %params:"=""%", "", "runas", 1 >> "%temp%\getadmin.vbs" 23 | 24 | "%temp%\getadmin.vbs" 25 | del "%temp%\getadmin.vbs" 26 | exit /B 27 | 28 | :gotAdmin 29 | pushd "%CD%" 30 | CD /D "%~dp0" 31 | :-------------------------------------- 32 | 33 | :: Get oculus install dir from the registry 34 | FOR /F "usebackq tokens=3*" %%A IN (`REG QUERY "HKLM\SOFTWARE\WOW6432Node\Oculus VR, LLC\Oculus" /v Base`) DO ( 35 | set oculusdir=%%A %%B 36 | ) 37 | :: Remove blank space at the end, if present 38 | if "%oculusdir:~-1%" EQU " " ( 39 | set oculusdir=%oculusdir:~0,-1% 40 | ) 41 | :: Execute oculus uninstaller 42 | "%oculusdir%OculusSetup.exe" /uninstall 43 | :: Restore hosts file 44 | copy "%cd%\hosts" "%windir%\System32\drivers\etc\hosts" /y 45 | 46 | PAUSE --------------------------------------------------------------------------------