Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @echo off
- SETLOCAL EnableDelayedExpansion
- for /F "tokens=1,2 delims=#" %%a in ('"prompt #$H#$E# & echo on & for %%b in (1) do rem"') do (
- set "DEL=%%a"
- )
- call :ColorText 0A "Batch pour autoriser et interdire la prise de main a distance sans confirmation"
- echo(
- call :ColorText 03 "- MB. Technology Inc 2016 -"
- echo(
- echo(
- echo(
- call :ColorText 0C "Attention, batch a executer imperativement en tant qu'administrateur"
- echo(
- echo(
- echo(
- rem requête de l'IP
- @SET /P adresse=[Entrez l'adresse IP du poste]
- rem Active la modification du registre à distance si nécessaire
- FOR /F "tokens=3 delims=: " %%H in ('sc query "RemoteRegistry" ^| findstr "STATE"') do (
- IF /I "%%H" NEQ "RUNNING" (
- sc \\%adresse% start RemoteRegistry
- sc \\%adresse% config RemoteRegistry start= auto
- )
- )
- :action
- set /p choix=Desactiver (D) ou reactiver (R) la confirmation (D/R)? :
- IF /I "%choix%"=="D" (
- goto desact
- ) else (
- IF /I "%choix%" NEQ "D" goto opt2
- )
- :opt2
- IF /I "%choix%"=="R" (
- goto react
- ) else (
- IF /I "%choix%" NEQ "R" goto action
- )
- :desact
- call :ColorText 0A "Desactiver la confirmation de l'utilisateur"
- REG ADD "\\%adresse%\HKLM\Software\intel\landesk\wuser32" /v "Permission Required" /t REG_DWORD /d 0 /F
- goto end
- :react
- call :ColorText 0C "Reactiver la confirmation de l'utilisateur"
- REG ADD "\\%adresse%\HKLM\Software\intel\landesk\wuser32" /v "Permission Required" /t REG_DWORD /d 1 /F
- goto end
- :end
- rem Arrête et redémarre le service de prise de main distant
- sc \\%adresse% stop ISSUSER
- pause
- sc \\%adresse% start ISSUSER
- goto :eof
- :ColorText
- echo off
- <nul set /p ".=%DEL%" > "%~2"
- findstr /v /a:%1 /R "^$" "%~2" nul
- del "%~2" > nul 2>&1
- goto :eof
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement