@ECHO OFF
:: color 0C & mode con LINES=20 COLS=80
@CLS
@ECHO.
@ECHO ************************************************************************
@ECHO ***
@ECHO ***	Gestionnaire identification - Erreur 0x80090345   
::      	Version du script :	14-01-2019
@ECHO ***
@ECHO ***
@ECHO ***	SVP NE FERMEZ PAS CETTE FENETRE
@ECHO ***
@ECHO ***	Mais vous pouvez lancer d'autres applications
@ECHO ***
@ECHO ***

:detect_archi
@REG QUERY HKLM\Hardware\Description\System\CentralProcessor\0  | Find /i "x86" >NUL
@IF %ERRORLEVEL%==0 (SET OS_ARCHI=x86) ELSE (SET OS_ARCHI=x64)

:: Detection OS
@SET OS_name=Windows
@FOR /F "tokens=3*" %%A IN ('REG QUERY "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v "ProductName"') DO SET OS_name=%%A %%B
@IF "%OS_name%"=="Microsoft Windows XP" (SET windows_ver=WinXP)
@IF "%OS_name%"=="Windows 7 Professional" (SET windows_ver=Win7)
@IF "%OS_name%"=="Windows 8 Professional" (SET windows_ver=Win8)
@IF "%OS_name%"=="Windows 10 Pro" (SET windows_ver=Win10)
@IF "%OS_name%"=="Microsoft Windows Server 2003 R2" (SET windows_ver=Win2003)
@IF "%OS_name%"=="Windows Server 2008 R2 Standard" (SET windows_ver=Win2008)
@IF "%OS_name%"=="Windows Server 2012 R2 Standard" (SET windows_ver=Win2012)
@IF "%OS_name%"=="Windows Server 2016 Standard" (SET windows_ver=Win2016)
:: Source d'installation
@SET rep_local=C:\softs
@IF NOT EXIST %rep_local% MD %rep_local%

@IF %windows_ver%==WinXP GOTO Win_XP
@IF %windows_ver%==Win7 GOTO Win_7
@IF %windows_ver%==Win8 GOTO Win_7
@IF %windows_ver%==Win10 GOTO Win_7
@IF %windows_ver%==Win2003 GOTO Logs
@IF %windows_ver%==Win2008 GOTO Logs
@IF %windows_ver%==Win2012 GOTO Logs
@IF %windows_ver%==Win2016 (GOTO Logs) ELSE (GOTO Fin)

:Win_XP
@SET Start=%ALLUSERSPROFILE%\Menu D‚marrer
@SET StartMenu=%ALLUSERSPROFILE%\Menu D‚marrer\Programmes
@SET StartMenuStartup=%ALLUSERSPROFILE%\Menu D‚marrer\Programmes\D‚marrage
@SET PublicDesktop=%ALLUSERSPROFILE%\Bureau
@SET UserStart=%USERPROFILE%\Menu D‚marrer
@SET UserStartMenu=%USERPROFILE%\Menu D‚marrer\Programmes
@SET UserStartMenuStartup=%USERPROFILE%\Menu D‚marrer\Programmes\D‚marrage
@SET UserDesktop=%USERPROFILE%\desktop
@GOTO Install

:Win_7
@SET Start=%ALLUSERSPROFILE%\Microsoft\Windows\Start Menu
@SET StartMenu=%ALLUSERSPROFILE%\Microsoft\Windows\Start Menu\Programs
@SET StartMenuStartup=%ALLUSERSPROFILE%\Microsoft\Windows\Start Menu\Programs\Startup
@SET PublicDesktop=%PUBLIC%\Desktop
@SET UserStart=%APPDATA%\Microsoft\Windows\Start Menu
@SET UserStartMenu=%APPDATA%\Microsoft\Windows\Start Menu\Programs
@SET UserStartMenuStartup=%APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup
@SET UserDesktop=%USERPROFILE%\desktop
@GOTO Install

:Install
@SET Prog_Ver=2019
@SET Prog_Nom=Corrige_Err_0x80090345
@SET Prog_Lnk=Corrige_Err_0x80090345.lnk
@SET Prog_StartMenu=Corrige_Err_0x80090345
@SET Prog_StartMenuGrp=
@SET Prog_Uninstallx86=
@SET Prog_Uninstallx64=
@SET Prog_Uninstallx86_Option=
@SET Prog_Uninstallx64_Option=
::@SET Prog_InstallX86=%source_install%\logiciels\utilitaires\BIG-IP_Edge_Client\Install\f5fpclients.msi
::@SET Prog_InstallX64=%source_install%\logiciels\utilitaires\BIG-IP_Edge_Client\Install\f5fpclients.msi
::@SET Prog_InstallX86_Option=/qn /passive
::@SET Prog_InstallX64_Option=/qn /passive
@SET Log_NomOld=%rep_local%\logs\%Prog_Nom%_*.log
@SET Log_NomNew=%rep_local%\logs\%Prog_Nom%_%Prog_Ver%.log
@IF NOT EXIST %rep_local%\logs MD %rep_local%\logs
@IF EXIST "%Log_NomOld%" DEL "%Log_NomOld%"
@ECHO Version %Prog_Ver% - %date% - %time% - Début >> %Log_NomNew%

@REG QUERY HKLM\Hardware\Description\System\CentralProcessor\0  | Find /i "x86" >NUL
@IF %ERRORLEVEL%==0 (GOTO x86) ELSE (GOTO x64)

:x86
@REG ADD HKLM\SOFTWARE\Microsoft\Cryptography\Protect\Providers\df9d8cd0-1501-11d1-8c7a-00c04fc297eb\ /v ProtectionPolicy /t REG_DWORD /d 00000001 /f
@GOTO :Raccourcis

:x64
@REG ADD HKLM\SOFTWARE\Microsoft\Cryptography\Protect\Providers\df9d8cd0-1501-11d1-8c7a-00c04fc297eb\ /v ProtectionPolicy /t REG_DWORD /d 00000001 /f
@REG ADD HKLM\SOFTWARE\Wow6432Node\Microsoft\Cryptography\Protect\Providers\df9d8cd0-1501-11d1-8c7a-00c04fc297eb /v ProtectionPolicy /t REG_DWORD /d 00000001 /f

:Raccourcis
@GOTO Logs

:Raccourcis_Win10

:Logs
::@IF NOT EXIST %rep_local%\logs MD %rep_local%\logs
::@IF EXIST "%Log_NomOld%" DEL "%Log_NomOld%"
@ECHO Version %Prog_Ver% - %date% - %time% - Fin >> %Log_NomNew%

:Fin
PAUSE