Skip to content

Instantly share code, notes, and snippets.

@AndrewMast
Last active November 21, 2024 23:25
Show Gist options
  • Save AndrewMast/742ac7e07c37096017e907b0fd8ec7bb to your computer and use it in GitHub Desktop.
Save AndrewMast/742ac7e07c37096017e907b0fd8ec7bb to your computer and use it in GitHub Desktop.
Commands to disable Riot Vanguard when you aren't playing Valorant

Commands to temporarily stop Riot Vanguard

As oddly as it sounds, people actually do other things on their computer than play Valorant. I've put together a few commands to turn off Riot Vanguard for when you aren't playing Valorant.

Proof that I'm not hacking your computer

On Riot's support website for Valorant, they list two commands in the third step in the process of manually uninstalling Riot Vanguard. Link to the page. These commands are sc delete vgc and sc delete vgk. These commands are telling Windows Services (known to the command line as sc) to delete two services (vgc and vgk). My commands simply disable these services from starting next time you start your computer by changing their configuration to disabled (ie. sc config vgc start= disabled)

Commands for people who don't know how commands work

If you don't know how commands work or you just want the easiest way to disable and enable Vanguard, I have created a few files for the best experience:

How to get these files:

Click here to download all of the files (same as hitting "Download ZIP" at the top right-ish of the page)

OR

  1. Click on one of the links above to scroll down to the file
  2. Right click on the "Raw" button for the file
  3. Select "Save Link As..." or "Download File As..."
  4. Before saving, make sure to set the "Save as type" field to All Files (*.*) to ensure that the file is saved with the extension .vbs (very important)

How these files work:

These files run the same commands provided below, but asks you to run the command as administrator first. Let's dissect the code, eh? Take disable_vanguard.vbs for example:

Call CreateObject("Shell.Application").ShellExecute("cmd.exe", "/c ""sc config vgc start= disabled & sc config vgk start= disabled""", "", "runas")

If you noticed, in the middle of this code you can see sc config vgc start= disabled & sc config vgk start= disabled which is the exact command that I provide for the more "experienced" people (see below). The Call CreateObject("Shell.Application").ShellExecute part of the code gets ready to launch command prompt. Then cmd.exe is given to this so it can be opened, and /c ""{...}"" simply tells command prompt what command to run (I left out the command on purpose). Finally, runas tells the code that it needs to ask you for permission to run the command as an administrator.

The restart command

If you choose to use the command to restart your computer, shutdown /r /f /t 00 is included in the command. shutdown tells command prompt that you want to shutdown your computer, but /r tells it to restart. /f tells it to close all open programs and /t 00 tells it to shutdown right away.

The close command

If you choose to use the command to stop Vanguard, net stop vgc & net stop vgk & taskkill /IM vgtray.exe is included in the command. net stop vgc and net stop vgk tells command prompt to stop the Vanguard services (see above for proof that these are actually Vanguard's services) and taskkill /IM vgtray.exe tells command prompt to close the Vanguard tray icon (otherwise it would stay open even after you stop the services)

Commands for experienced cmders

If you know how to open an elevated command prompt (super easy, barely an inconvenience: search for cmd in the start menu, right click it, run as admin), then you can just run these commands to disable or enable Riot Vanguard (still requires a reboot once you enable it)

# Disable Vanguard (in disable_vanguard.vbs)
sc config vgc start= disabled & sc config vgk start= disabled

# Disable and stop Vanguard (in disable_vanguard_stop.vbs)
sc config vgc start= disabled & sc config vgk start= disabled & net stop vgc & net stop vgk & taskkill /IM vgtray.exe

# Enable Vanguard (in enable_vanguard.vbs)
sc config vgc start= demand & sc config vgk start= system

# Enable Vanguard and restart your computer (in enable_vanguard_restart.vbs)
sc config vgc start= demand & sc config vgk start= system & shutdown /r /f /t 00
' Disables Vanguard from starting when you boot your computer
Call CreateObject("Shell.Application").ShellExecute("cmd.exe", "/c ""sc config vgc start= disabled & sc config vgk start= disabled""", "", "runas")
' Disables Vanguard from starting when you boot your computer and also stops Vanguard
Call CreateObject("Shell.Application").ShellExecute("cmd.exe", "/c ""sc config vgc start= disabled & sc config vgk start= disabled & net stop vgc & net stop vgk & taskkill /IM vgtray.exe""", "", "runas")
' Enables Vanguard so it starts next time you boot your computer
Call CreateObject("Shell.Application").ShellExecute("cmd.exe", "/c ""sc config vgc start= demand & sc config vgk start= system""", "", "runas")
' Enables Vanguard and then reboots your computer to Vanguard
Call CreateObject("Shell.Application").ShellExecute("cmd.exe", "/c ""sc config vgc start= demand & sc config vgk start= system & shutdown /r /f /t 00""", "", "runas")
@jxchlee
Copy link

jxchlee commented Jun 2, 2024

Thanks a lot for your guide Andrew!

I took inspiration from your guide and made a all in one batch script that might be useful for some people. I decided to write this script to overcome some "issues" I personally had. I did not like the need for multiple scripts and also have VBS disabled by default which was my main issue 😄

The script does almost everything in one run

  • Check if vgc and vgk are set to start automatically

    • Disable and stop them if they are
    • Enable auto starting if its disabled
  • Kill vgtray.exe if it is running

I removed the restart since I personally dont need it, but it can easily be added.

@echo off

@REM Checks if vgc is auto starting
@REM If it is we disable the auto start and attempt to stop the service
for /F "tokens=3 delims=: " %%H in ('sc qc "vgc" ^| findstr /i "START_TYPE"') do (
  if /I "%%H" EQU "DEMAND_START" (
   sc config vgc start= disabled
   echo Disabled vgc AutoStart
   call :CheckServiceState vgc
  ) else (
    sc config vgc start= demand
    echo Enabled vgc auto starting
  )
)

@REM Check if vgk AutoStart is enabled
@REM If it is we disable the auto start and attempt to stop the service
for /F "tokens=3 delims=: " %%H in ('sc qc "vgk" ^| findstr /i "START_TYPE"') do (
  if /I "%%H" EQU "SYSTEM_START" (
   sc config vgk start= disabled
   echo Disabled vgk AutoStart
   call :CheckServiceState vgk
  ) else (
    sc config vgk start= system
    echo Enabled vgk auto starting
  )
)

@REM Kill vgtray.exe if it is running else print an empty line
tasklist | find /i "vgtray.exe" && taskkill /im vgtray.exe /F || echo(

pause


@REM Check if a service with the supplied name is running and stop it in case it is running
:CheckServiceState
for /F "tokens=3 delims=: " %%H in ('sc query "%~1" ^| findstr /i "STATE"') do (
  if /I "%%H" EQU "RUNNING" (
   net stop %~1
   echo Stopped Service %~1
  )
)
exit /B

Hello. Your batch code is working well. And I wonder if it is possible to switch the status of startup program named vgtray, enable or disable?

After turning off vgk and vgc with your code and rebooting, there is a vangaurd icon at the tool bar.
vang1

It seems be caused from start up program list in the task manager.
image

The vgtray in the picture is on disable because I've changed it myself. After that, there isn't vangaurd icon on the tool bar.
So my question is can you make code for switching the status of startup program, enable - disable?

I don't want to see the vangaurd icon even though I turn off vgc and vgk. But It's so boring to switch manually every time that I turn on and off. So I hope to include this feature in the code as well so that It change the start up status automatically with other setting.

@Simon-12
Copy link

Hey @AndrewMast, thanks a lot for providing the scripts.

I also took the inspiration and created a command line interface in C++ and a simple user interface to turn Riot Vanguard on and off, as well as adding a shortcut to the startup folder.

Just have a look and check it out, I also linked this site here ;)
github/Simon-12/vanguard-out

Cheers

@s1ryx
Copy link

s1ryx commented Sep 28, 2024

Did anyone find a solution on how to just allow it for the next boot? I would like to explicitly allow the spyware to run for just one boot and then have the script execute once the game exits or the user logs off.

@ragabmigo
Copy link

Good evening guys, please I am looking for someone to implement a script for the Valorant game that plays Automatic Blackout. This is the WhatsApp number to contact: 966506349942

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment