123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- @echo off
- rem Version 02.11.2017
- rem ================================================================================
- rem Check for admin rights
- if '%1'=='ELEV' (shift /1 & goto Install)
- >nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
- if %errorlevel% neq 0 (
- goto Elevate
- )
- :Install
- rem ================================================================================
- rem If specified, parameter must contain path to log directory
- set log_dir=%~1
- if ^"%log_dir%^" neq "" (
- set fin=%log_dir:~-1%
- if "%fin%" neq "\" (set log_dir=%log_dir%\)
- )
- rem ================================================================================
- rem Obtaining necessary paths
- rem You can set Citrix PvD config path if it does not match default
- set configpath="%ProgramData%\Citrix\personal vDisk\Config"
- >nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" %configpath%
- call :CheckStatus "[ERROR] Invalid Citrix PvD config path"
- rem ================================================================================
- rem Change Altitude
- reg add "HKLM\System\CurrentControlSet\Services\SnCloneVault\Instances\SnCloneVault Instance" /v Altitude /t REG_SZ /d 134100 /f
- call :CheckStatus "[ERROR] Failed to change Altitude for driver SnCloneVault"
- reg add "HKLM\System\CurrentControlSet\Services\SnEraser\Instances\SnEraser Instance" /v Altitude /t REG_SZ /d 134110 /f
- call :CheckStatus "[ERROR] Failed to change Altitude for driver SnEraser"
- reg add "HKLM\System\CurrentControlSet\Services\SnSdd\Instances\SnSdd Instance" /v Altitude /t REG_SZ /d 134119 /f
- call :CheckStatus "[ERROR] Failed to change Altitude for driver SnSdd"
- reg add "HKLM\System\CurrentControlSet\Services\SnFileControl\Instances\SnFileControl Instance" /v Altitude /t REG_SZ /d 134120 /f
- call :CheckStatus "[ERROR] Failed to change Altitude for driver SnFileControl"
- rem ================================================================================
- rem Add parameter for device control
- reg add "HKLM\System\CurrentControlSet\Services\SnDDD\DC" /v AllowUnknownDisk /t REG_DWORD /d 1 /f
- call :CheckStatus "[ERROR] Failed to set parameter AllowUnknownDisk"
- rem ================================================================================
- rem Add parameter for database handling
- reg add "HKLM\SYSTEM\CurrentControlSet\Services\SnCC0" /v ClearDatabaseLogs /t REG_DWORD /d 1 /f
- call :CheckStatus "[ERROR] Failed to set parameter ClearDatabaseLogs"
- rem ================================================================================
- rem Configure Citrix PvD
- echo Writing to file %configpath%\custom_folders_rules.txt
- echo [Rule-Begin]>> %configpath%\custom_folders_rules.txt
- echo Type=File-Catalog-Construction>> %configpath%\custom_folders_rules.txt
- echo Action=Catalog-Location-Guest-Modifiable>> %configpath%\custom_folders_rules.txt
- echo name="%%PROGRAMFILES%%\Secret Net Studio\Client\Grouppolicy\*">> %configpath%\custom_folders_rules.txt
- echo name="%%PROGRAMFILES%%\Secret Net Studio\Client\Grouppolicy\**\*">> %configpath%\custom_folders_rules.txt
- echo name="%%PROGRAMFILES%%\Secret Net Studio\Client\icheck\**\*">> %configpath%\custom_folders_rules.txt
- echo [Rule-End]>> %configpath%\custom_folders_rules.txt
- echo.>> %configpath%\custom_folders_rules.txt
- echo [Rule-Begin]>> %configpath%\custom_folders_rules.txt
- echo Type=Inclusion-Exclusion>> %configpath%\custom_folders_rules.txt
- echo Action=Exclude-Diff>> %configpath%\custom_folders_rules.txt
- echo name="\System Volume Information\SnCloneVault\**\*">> %configpath%\custom_folders_rules.txt
- echo [Rule-End]>> %configpath%\custom_folders_rules.txt
- echo Writing to file %configpath%\custom_regkey_rules.txt
- echo [Rule-Begin]>> %configpath%\custom_regkey_rules.txt
- echo Type=Conflict-Resolution>> %configpath%\custom_regkey_rules.txt
- echo Action=use-fullsrc-backup-fulldst>> %configpath%\custom_regkey_rules.txt
- echo name="SECURITY\SNET\**\*">> %configpath%\custom_regkey_rules.txt
- echo name="SOFTWARE\infosec\**\*">> %configpath%\custom_regkey_rules.txt
- echo name="snddd\dc\**\*">> %configpath%\custom_regkey_rules.txt
- echo name="snfilecontrol\sectree\**\*">> %configpath%\custom_regkey_rules.txt
- echo [Rule-End]>> %configpath%\custom_regkey_rules.txt
- rem ================================================================================
- if "%log_dir%" neq "" (
- echo Configuration done > "%log_dir%success.%computername%.%userdomain%.citrix_config.log"
- ) else (
- color 0A
- echo Configuration done
- pause
- )
- exit /b
- rem ================================================================================
- :CheckStatus
- if %errorlevel% neq 0 (
- if "%log_dir%" neq "" (
- echo %~1 > "%log_dir%fail.%computername%.%userdomain%.citrix_config.log"
- ) else (
- color 0C
- echo.
- echo %~1
- echo.
- pause
- )
- exit
- )
- exit /b
- rem ================================================================================
- rem Run script elevated (UAC)
- :Elevate
- set "vbsGetPrivileges=%temp%\SNgetPriv_%~n0.vbs"
- echo.
- echo **************************************
- echo Running as administrator
- echo **************************************
- echo Set UAC = CreateObject^("Shell.Application"^) > "%vbsGetPrivileges%"
- echo args = "ELEV " >> "%vbsGetPrivileges%"
- echo For Each strArg in WScript.Arguments >> "%vbsGetPrivileges%"
- echo args = args ^& strArg ^& " " >> "%vbsGetPrivileges%"
- echo Next >> "%vbsGetPrivileges%"
- echo args = "/c """ + "%~f0" + """ " + args >> "%vbsGetPrivileges%"
- echo UAC.ShellExecute "%SystemRoot%\system32\cmd.exe", args, "", "runas", 1 >> "%vbsGetPrivileges%"
- rem echo UAC.ShellExecute "%~f0", args, "", "runas", 1 >> "%vbsGetPrivileges%"
- "%SystemRoot%\system32\WScript.exe" "%vbsGetPrivileges%" %*
- exit /b
|