Kaseya Community

K2 and Safe Mode

  • Hello,

    We've recently rolled out K2 and are working out some minor kinks. Here's an issue we're having that I need to resolve quickly. For some reason since the v6.0 agent has been rolled out, the Kaseya Service won't start in Safe Mode. This is a serious problem for Spyware/Virus cleaning. Not to mention the fact that if I run the Safe Mode reboot script, it changes the boot.ini file on the machine and it won't get back into Normal Mode until the reverse is ran.

    I've tested on a few VMs in our office and the same thing happens regardless of the machine. Any ideas?

    Legacy Forum Name: K2 and Safe Mode,
    Legacy Posted By Username: jwible
  • the reason is due to service name changes...

    At least in my Safe Mode script, it writes 2 reg files to the temp drive and then runs them. These add the following keys, which is supposed to allow the start up of the Kaseya Agent and VNC in SafeMode. The problem is with K2 is that the Kaseya Agent service name has changed and is now "KA*" with * being a variable for your product key. You will need to modify the script to add the correct registry key via command line with the embeded variable. I am working on this for myself today and will post if i can come to a final script.

    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SafeBoot\Network\KaUsrTsk]
    @="Service"

    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SafeBoot\Network\KaseyaAgent]
    @="Service"

    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SafeBoot\Network\WinVNC4]
    @="Service"

    Legacy Forum Name: Scripts Forum,
    Legacy Posted By Username: djennings
  • Shortly after posting that, I realized that the Service was the issue.  Here's my script, it's been tested and works 100%.
    
    [HTML]<?xml version="1.0" encoding="utf-8"?>
    <ScriptExport xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.kaseya.com/vsa/2008/12/Scripting">
      <Procedure name="KaseyaAgentRegFix" treePres="3">
        <Body description="">
          <If description="">
            <Condition name="True" />
            <Then>
              <Statement description="" name="WriteFile" continueOnFail="false">
                <Parameter xsi:type="StringParameter" name="Path" value="c:\kaseya.reg" />
                <Parameter xsi:type="StringParameter" name="ManagedFile" value="VSASharedFiles\RegFix\Kaseya.reg" />
              </Statement>
              <Statement description="" name="ExecuteShellCommand" continueOnFail="false">
                <Parameter xsi:type="StringParameter" name="Command" value="regedit /S c:\Kaseya.reg regedit /S Kaseya.reg @echo off" />
                <Parameter xsi:type="EnumParameter" name="ExecuteAccount" value="System" />
                <Parameter xsi:type="BooleanParameter" name="Is64Bit" value="False" />
              </Statement>
              <Statement description="" name="DeleteFile" continueOnFail="false">
                <Parameter xsi:type="StringParameter" name="Path" value="c:\kaseya.reg" />
              </Statement>
            </Then>
          </If>
        </Body>
      </Procedure>
    </ScriptExport>[/HTML]
    
    It copies a Shared File [Kaseya.reg] to [c:\Kaseya.reg], then executes it quietly, then deletes the file.  Kaseya.reg looks like this...
    
    [HTML]Windows Registry Editor Version 5.00
    
    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SafeBoot\Network\YOURAGENTNAME**]
    @="Service"[/HTML]
    
    Replace the **YOURAGENTNAME** with the exact name of your Kaseya Agent Service name.  Once you run that, the PC will be able to reboot in Safe Mode and it will automatically start the Kaseya Service.

    Legacy Forum Name: Scripts Forum,
    Legacy Posted By Username: jwible


    [edited by: Brendan Cosgrove at 5:31 PM (GMT -8) on 12-17-2010] .
  • Boy howdy, do I wish I'd run into this forum post before I rendered a PC useless this morning by trying the Safe Mode Reboot trick... time to update my Safe Mode Reboot script!

    (If all you're doing is creating one entry in the registry, why not just script that instead of running a REG file?)

    Legacy Forum Name: Scripts Forum,
    Legacy Posted By Username: GreyDuck
  • Doh, That would make more sense. I think I just got this in my head and ran with it without thinking. It worked fine, though.

    Legacy Forum Name: Scripts Forum,
    Legacy Posted By Username: jwible
  • Hey sorry, I'm still a little confused b/c i can't get the K service to start in safe mode... I'm using K2.

    I've tried everything Kaseya Service, Kaseya...and the list goes on...

    What are you refering to when you say **YourAgentName** ?? Or how to I determine that?

    Thank you.

    Legacy Forum Name: Scripts Forum,
    Legacy Posted By Username: jrocker
  • I figured it out, if anyone is looking for this... I found mine in the registry, but i'm sure there is an easier way...

    Look for your KA..service here

    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services

    Legacy Forum Name: Scripts Forum,
    Legacy Posted By Username: jrocker
  • You guys might want to consider rolling out the changes that enable the K services to start under safe mode to all your managed machines. This is what we do.

    This way, if a coputer dies and can only get into safe mode, your K Agent will be pre-configured to work and check in.

    Legacy Forum Name: Scripts Forum,
    Legacy Posted By Username: XeviouS
  • with K2, looks like the Kaseya Agent service names are basically the GUID for the machine. Any hints on scripting this so that we could insert the GUID automagically into 'YOURAGENTNAME'?

    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SafeBoot\Network\YOURAGENTNAME**]
    @="Service"

    After a regsearch, I could not find the GUID as a value except under a 'KES_owned' key, so I am having a hard time getting a variable to assign.

    Legacy Forum Name: Scripts Forum,
    Legacy Posted By Username: bretj
  • You can create a variable, assign it the KA name of your service (copied out of the registry), and assign to all your groups. Then you can simply refer to it as in your scripts (if that is the name you gave the variable.)

    Legacy Forum Name: Scripts Forum,
    Legacy Posted By Username: Lmhansen
  • bretj
    with K2, looks like the Kaseya Agent service names are basically the GUID for the machine. Any hints on scripting this so that we could insert the GUID automagically into 'YOURAGENTNAME'?

    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SafeBoot\Network\YOURAGENTNAME**]
    @="Service"

    After a regsearch, I could not find the GUID as a value except under a 'KES_owned' key, so I am having a hard time getting a variable to assign.


    the service name/install path etc is your company UID... so it differes from client to client (you me and that other dude over there) but should be the same from end point to and point (your client a, your client b, and your client c)

    Legacy Forum Name: Scripts Forum,
    Legacy Posted By Username: thirteentwenty