Advertisement
lincruste

Remotely deactivate Landesk RC user confirmation

Oct 2nd, 2016
438
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @echo off
  2. SETLOCAL EnableDelayedExpansion
  3. for /F "tokens=1,2 delims=#" %%a in ('"prompt #$H#$E# & echo on & for %%b in (1) do rem"') do (
  4. set "DEL=%%a"
  5. )
  6. call :ColorText 0A "Batch pour autoriser et interdire la prise de main a distance sans confirmation"
  7. echo(
  8. call :ColorText 03 "- MB. Technology Inc 2016 -"
  9. echo(
  10. echo(
  11. echo(
  12. call :ColorText 0C "Attention, batch a executer imperativement en tant qu'administrateur"
  13. echo(
  14. echo(
  15. echo(
  16. rem requête de l'IP
  17. @SET /P adresse=[Entrez l'adresse IP du poste]
  18. rem Active la modification du registre à distance si nécessaire
  19. FOR /F "tokens=3 delims=: " %%H in ('sc query "RemoteRegistry" ^| findstr "STATE"') do (
  20. IF /I "%%H" NEQ "RUNNING" (
  21. sc \\%adresse% start RemoteRegistry
  22. sc \\%adresse% config RemoteRegistry start= auto
  23.   )
  24. )
  25.  
  26. :action
  27. set /p choix=Desactiver (D) ou reactiver (R) la confirmation (D/R)? :
  28.  
  29. IF /I "%choix%"=="D" (
  30. goto desact
  31. ) else (
  32. IF /I "%choix%" NEQ "D" goto opt2
  33. )
  34. :opt2
  35. IF /I "%choix%"=="R" (
  36. goto react
  37. ) else (
  38. IF /I "%choix%" NEQ "R" goto action
  39. )
  40.  
  41. :desact
  42. call :ColorText 0A "Desactiver la confirmation de l'utilisateur"
  43. REG ADD "\\%adresse%\HKLM\Software\intel\landesk\wuser32" /v "Permission Required"  /t REG_DWORD /d 0 /F
  44. goto end
  45.  
  46. :react
  47. call :ColorText 0C "Reactiver la confirmation de l'utilisateur"
  48. REG ADD "\\%adresse%\HKLM\Software\intel\landesk\wuser32" /v "Permission Required"  /t REG_DWORD /d 1 /F
  49. goto end
  50.  
  51. :end
  52. rem Arrête et redémarre le service de prise de main distant
  53. sc \\%adresse% stop ISSUSER
  54. pause
  55. sc \\%adresse% start ISSUSER
  56.  
  57. goto :eof
  58.  
  59. :ColorText
  60. echo off
  61. <nul set /p ".=%DEL%" > "%~2"
  62. findstr /v /a:%1 /R "^$" "%~2" nul
  63. del "%~2" > nul 2>&1
  64. goto :eof
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement