Friday 19 February 2010

Use Kaseya to Boot in to Safe Mode with VNC Access

Have you ever had trouble with a Remote PC, maybe with a virus, or a driver corruption, where you just needed to get into Safe Mode but didn't want to arrange a site visit?

The following Kaseya Scripts will add the VNC Client and the Kaseya Agent to the startup registry for Safe Mode, then restart the machine (with a 2 minute warning to the User) that machine is about to reboot into Safe Mode.

The Script edits boot.cfg so that the next time the machine restarts it boots into Safe Mode with Networking.

--

Script Name: Boot Into Safe Mode With VNC (PT1)
Script Description: [posted by geoff@lynxcomputing.com]
Edits the Registry to include WinVNC and KaseyaAgent in safe mode services. Edits boot.ini. Reboots into Safe Mode after 2 mins - Remote Controllable!

IF True
THEN
Set Registry Value
Parameter 1 : HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SafeBoot\Network\WinVNC4\
Parameter 2 : Service
Parameter 3 : REG_SZ
OS Type : 0
Pause Script
Parameter 1 : 10
OS Type : 0
Set Registry Value
Parameter 1 : HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SafeBoot\Network\KaseyaAgent\
Parameter 2 : Service
Parameter 3 : REG_SZ
OS Type : 0
Pause Script
Parameter 1 : 10
OS Type : 0
Send Message
Parameter 1 : This Machine Will ReBoot Into Safe Mode in 2mins. Please Save All Open Documents.
Parameter 2 : 1
OS Type : 0
Pause Script
Parameter 1 : 120
OS Type : 0
Write Script Log Entry
Parameter 1 : The Machine Was Sent A Command To ReBoot Into Safe Mode
OS Type : 0
Execute Shell Command
Parameter 1 : bootcfg /Raw "/safeboot:network /sos /bootlog /noguiboot" /id 1
Parameter 2 : 1
OS Type : 0
Pause Script
Parameter 1 : 10
OS Type : 0
Reboot
OS Type : 0
ELSE

--

Hey Presto! The PC reboots, the agent comes back online, and you have remote access to the PC in Safe Mode.

Now you need to restart the machine into normal mode. You'll need another script that changes boot.cfg to restart the machine normally.

--

Script Name: Boot Into Safe Mode With VNC (PT2)
Script Description: [posted by geoff@lynxcomputing.com]
Restores Boot.ini to standard. Reboots into Windows (Instant).

IF True
THEN
Execute Shell Command
Parameter 1 : bootcfg /Raw "/noexecute=optin /fastdetect" /id 1
Parameter 2 : 1
OS Type : 0
Pause Script
Parameter 1 : 10
OS Type : 0
Write Script Log Entry
Parameter 1 : The Machine Was ReBooted into Windows
OS Type : 0
Reboot
OS Type : 0
ELSE

--

Posted by Geoff


Follow Lynx on Twitter
http://twitter.com/geoff_lynx
http://twitter.com/CiaranJKenny