We're in a situation where we were testing out the agents with the eval product. We since purchased a Kaseya license and had to kill the eval Kaseya server we built. So, the agents can't communicate with the original, eval Kaseya server. We're building a new Kaseya server.
What we want to do is set up the agents that were deployed during our eval phase from the eval Kaseya server and have them point to our new, production Kaseya server.
What's the best method for getting this done?
What I was thinking was...
1. Uninstall the agents that were deployed from the eval Kaseya server and reboot the client workstations.
2. Install the new agents from the production Kaseya server.
But what would be nicer is to have the agents point to the new Kaseya server instead of reinstalling. Plus, if we reinstall, is there a way to uninstall the Kaseya agents via command line but not via Kaseya, meaning that since there is no communication between the eval agents and the production server, we'd have to use Active Directory to push out a batch script to uninstall the eval agents and reboot the workstations. But I don't know what type of command to include in the batch script.
Just looking for some advice if anyone has any. Thanks from a first-time forum poster.
You have a couple options.
1. Setup your agent packages with the /R switch to force reinstall. Then use LAN Watch to push out like usual.
2. On your eval server, point the agents to the new server from Agent > Check-in control
3. Uninstall string for the agent C:\Program Files\Kaseya\Agent\KASetup.exe /r /g <Your Unique String> /l "%TEMP%\kasetup.log"
Alternatively you could reinstall using the "Force Reinstallation Switch" which will force the old agents to be over written by your new agents with the correct server details.
You could do this all automatically by creating an Agent Install Policy for Domains PCs or a just 1 Domain account.
Ok, didn't mention this previously. The eval server is kaput because the license is no longer valid, so I can't go into the server portal and run the Agent uninstall from there. I'll try the uinstall string as suggested. As for the <unique string> portion, is that going to be different for each agent? Plus, what do all those switches mean?
With the /R option, this would be 2 client packages from 2 different Kaseya servers. If we deploy the new client package to a client that had the old, eval agent on it, what would happen to the old agent installed from the now defunct eval server? Would the old agent package be uninstalled? Can both the new and old coexist?
Agent Install Command Line Switches
Agent install command line switches for KcsSetup are case insensitive and order independent. Separate switches with an empty space. For example: KcsSetup /e /g=root.unnamed /c
Note: For Macintosh agents, command line switches can only be used when creating the agent install package.
/b - Reboot the system after installation completes. Agent installation requires a reboot in order to load its drivers. Use this switch on packages given to users that do not have rights to shut down the computer.
/c - Use the computer name as the machine ID for the new account. If the computer name cannot be determined programmatically, the machine user is prompted to enter a machine ID. The exception is silent mode, /s, in which case the installation stops and an error is logged to the installation log.
/d - Use the current domain name as the group ID for the new account. If the domain name cannot be determined programmatically, the machine user is prompted to enter the group ID. The exception is silent mode, /s, in which case the installation stops and an error is logged to the installation log.
/e - Exit immediately if the installer detects that an agent is already installed. Use /e at the end of logon procedures. /k or /r overrides /e.
/f "Publisher" - Specifies the full name of the service provider or tenant. Windows only.
/g=xxx - Specifies the group ID to use for the new account. xxx must be an alpha-numeric string and can not contain spaces or punctuation marks.
/h - Display the help dialog box listing all the command line switches, unless the /s switch is set, in which case the application exits.
/i - Ignore non-critical errors such as incorrect or indeterminate versions of WinSock2, or indeterminate versions of the OS, and force the installation to proceed.
/j - Does not install an agent shortcut to the Start > All Programs menu. Windows only.
/k - Displays a dialog box asking the user if it is OK to re-install when the agent is already detected on the machine. Without this switch, the installer exits if an agent is already present.
/m=xxx - Specifies the machine ID to use for the new account. xxx must be an alpha-numeric string and can not contain spaces or any punctuation marks except period(.).
/n = partitionId - Specifies the partition ID of the tenant partition the installed agent/machine ID account is a member of.
/o "Company Title" - Specifies the company title of the service provider or tenant. Windows only.
/p "install_path" - Overrides the default installation path by specifying the full directory path, including drive letter, in which to install the agent. By default, the agent installation creates a directory named Program Files\Kaseya\Agent off the root of the drive on which Windows is installed.
/r - Executes the installation program and re-installs the agent even if an agent is already on the machine.
/s - Runs in silent mode. Suppresses all dialog boxes.
/t "Title" - Specifies the title of any dialog windows shown to the machine user during installation. The default title is: "Kaseya Agent".
/u - Uses the current machine user name as the machine ID for the new account. If the machine user name cannot be determined programmatically, the user is prompted to enter a machine ID. The exception is silent mode, /s, in which case the installation stops and an error is logged to the installation log.
/w - Overwrites the existing configuration file with a configuration file included in the agent installation. Use with the /r switch to re-install an agent with new server settings. Intended for an existing agent that is attempting to connect to a server that no longer exists.
/x - Disables remote control after successfully installing the agent. This option is ignored when updating or re-installing. Remote control of this machine can only occur after the user selects Enable Remote Control by right clicking the K icon on the system tray.
/z “Message” - Specifies the message shown to the user when installation completes. The exception is silent mode, /s, in which case the installation completes and the status message is written to the installation log. The default message is: "The Agent has been installed successfully on your computer.”
/? = Display the help dialog box listing all the command line switches, unless the /s switch is set, in which case the application exits. Windows only.
Linux Only Install Switches
See Installing Linux Agents.
Topic 493: Send Feedback. Download a PDF of this online book from the first topic in the table of contents. Print this topic.
So personally I would create a new agent using "/r /s /w" switches...
Then you can either run this by a login script or probably easier deploy it automatically using the GP Deploy options, there is two ways you can do that, either install it on all workstations you name \ select or assign it to a user account, when that account logs in the new agent will be deployed.
Ok, so with the unique string, this is what I'm seeing for the path to the agent installation:
C:\Program Files (x86)\Kaseya\XXXXXX03652483032792\Kasetup.exe
It's a little different than the path you suggested:
C:\Program Files\Kaseya\Agent\KASetup.exe /r /g <Your Unique String> /l "%TEMP%\kasetup.log"
Would my command be this then?
C:\Program Files (x86)\Kaseya\XXXXXX03652483032792\KASetup.exe /r /g <XXXXXX03652483032792> /l "%TEMP%\kasetup.log"
Also, do I need the closed brackets on the two ends of the unique string < > ?
Yes that is right, brackets are not required, out of interest through why are you uninstalling and not just replacing agent \ settings as I advised before, should save you a lot of grief in the long run, partly because there is less steps and partly as your agents will keep any existing monitor sets etc.
The install path will only have the GUID if the agent was installed with K2. If the agent was installed using Kaseya v5, it won't have the GUID in the path. So, you have to account for both circumstances.
I made a little batch file to help you. This will look at the Kaseya Agent service for you and get the GUID, then it will figure out where the correct installation directory is per the service configuration, then it will execute the KASetup.exe in that directory with the silent reinstall switches with your custom GUID.
@echo offfor /f "tokens=3 delims= " %%A in ('sc getkeyname "Kaseya Agent"') do set KGUID=%%Afor /f "delims=" %%A in ('sc qc %KGUID% ^| find "BINARY_PATH_NAME"') do set KPATH=%%Afor %%A in (%KPATH%) do set KPATH=%%Aset KPATH=%KPATH:BINARY_PATH_NAME=%set KPATH=%KPATH:: =%set KPATH=%KPATH:"=%set KPATH=%KPATH:\AgentMon.exe=%"%KPATH%\KASetup.exe" /r /s /g %KGUID% /l "%TEMP%\kasetup.log"
If you are looking to use Dan's code to do an uninstall (not repair/re-install) you can simple modify the code slightly.
@echo offfor /f "tokens=3 delims= " %%A in ('sc getkeyname "Kaseya Agent"') do set KGUID=%%Afor /f "delims=" %%A in ('sc qc %KGUID% ^| find "BINARY_PATH_NAME"') do set KPATH=%%Afor %%A in (%KPATH%) do set KPATH=%%Aset KPATH=%KPATH:BINARY_PATH_NAME=%set KPATH=%KPATH:: =%set KPATH=%KPATH:"=%set KPATH=%KPATH:\AgentMon.exe=%"%KPATH%\KASetup.exe" /r /g %KGUID% /l "%TEMP%\kasetup.log"
Note that that is a lowercase "l", not an uppercase i
I recommend adding the /s switch to sschill's uninstall batch script above otherwise it will prompt the user if they are sure they want to remove the program (tested in XP).
Silent/automated uninstall of Kaseya agent:
Tony, The first posted revision had the /s switch in it already.
Dan, it also had an incorrect capital /I switch instead of a lowercase /l switch for the logging. Only the script in my posting will achieve a correct silent uninstallation of the agent, therefore I win! ;)
I couldn't tell from the wysiwyg font if it was an I or l, so I changed it to an l - thanks for the correction.
I wasn't aware that we were playing a game. If you are, congratulations!