Guest User

Untitled

a guest
Apr 8th, 2016
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.77 KB | None | 0 0
  1. :: 1) Download srvany.exe from Microsoft Windows 2003 Resource Kit (available free from Microsoft).
  2. :: 2) Copy srvany.exe into the folder where google drive is installed or next to this script file.
  3. :: 3) Run this script as an Administrator
  4.  
  5. echo off
  6. cls
  7.  
  8. SET STARTING_DIR=%CD%
  9. SET SCRIPT_DIR=%~dp0
  10.  
  11. echo Running from: %STARTING_DIR%
  12. echo Script Dir: %SCRIPT_DIR%
  13.  
  14. :cd /d %SCRIPT_DIR%..\backup\mongodb
  15. :echo Changed to dir: %STARTING_DIR%
  16.  
  17. SET DEFAULT_USERNAME=%USERDOMAIN%\%USERNAME%
  18. SET /P UNAME=Enter username for account to run service under. (%DEFAULT_USERNAME%) || SET UNAME=%DEFAULT_USERNAME%
  19. SET /P PWORD=Enter %UNAME% password. || Set PWORD=NothingChosen
  20.  
  21. If "%PWORD%"=="NothingChosen" goto :sub_error_nopass
  22.  
  23. echo Copying srvany.exe to C:\Program Files (x86)\Google\Drive
  24. copy %SCRIPT_DIR%\srvany.exe "C:\Program Files (x86)\Google\Drive"
  25.  
  26. echo Adding Google Drive as a service...
  27. echo sc create GoogleDriveSync displayName="Google Drive Service" start=auto obj="%UNAME%" password=%PWORD% binPath="C:\Program Files (x86)\Google\Drive\srvany.exe"
  28. sc create GoogleDriveSync displayName="Google Drive Service" start=auto obj="%UNAME%" password=%PWORD% binPath="C:\Program Files (x86)\Google\Drive\srvany.exe"
  29.  
  30. echo Updating registry for service...
  31. REG ADD HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\GoogleDriveSync\Parameters /f
  32. REG ADD HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\GoogleDriveSync\Parameters /v Application /d "C:\Program Files (x86)\Google\Drive\googledrivesync.exe" /f
  33. REG ADD HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\GoogleDriveSync\Parameters /v AppParameters /d "/autostart --noshow_confirmation_dialog_on_delete" /f
  34.  
  35. echo Starting service...
  36. net start GoogleDriveSync
  37.  
  38.  
  39. echo Finished.
  40. pause
  41. goto:eof
  42.  
  43.  
  44. :sub_error_nopass
  45. echo No password given. Ending.
Add Comment
Please, Sign In to add comment