Reboot to Safe Mode w/Net during SR's third party section

You need help to start using UVK? You have a doubt on a UVK feature? Post here!
Forum rules
We have no special rules for UVK forums. Just try to be polite and clear in your posts.
Please don't post spam in this forum. Spammers will be banned by IP, e-mail and username.
We reserve the right to delete all posts and ban all users we consider not having respected these rules without warning.
Post Reply
Xander
Posts: 438
Joined: Sun May 24, 2015 11:55 pm
Contact:

Reboot to Safe Mode w/Net during SR's third party section

Post by Xander »

Right now, I've got my SR setup doing a reboot to safe mode and I'm looking at including another app that highly recommends rebooting after it runs and, for the sake of other scanners, I want to be able to stay in safe mode w/net when it boots back up.

So....would this work?
Fix #1
Command 1: bcdedit /set {current} safeboot network
Command 2: shutdown /r

Fix #2
Command 1: bcdedit /deletevalue {current} safeboot


Also, would UVK's run-on-reboot be already active or does that only get engaged when one of the built-in reboots gets done?
Fred
Site Admin
Posts: 2357
Joined: Sat Jul 30, 2011 12:05 pm
Location: Red coast, France
Contact:

Re: Reboot to Safe Mode w/Net during SR's third party section

Post by Fred »

Xander,

Yes that should work. You can just use the full path of bcdedit, in case malware has left some other bcdedit files wondering around, and tweak the shutdown command so you reboot immediately instead of waiting 30 seconds.

Fix 1:

Code: Select all

%Systemdir%\bcdedit.exe /set {current} safeboot network
%Systemdir%\shutdown.exe /r /t 0
Fix 2:

Code: Select all

%Systemdir%\bcdedit.exe /deletevalue {current} safeboot
One thing we humans have in common is that we are all different. So, if you think you're weird because you're different from everyone else, then we are all weird.

Fred
Xander
Posts: 438
Joined: Sun May 24, 2015 11:55 pm
Contact:

Re: Reboot to Safe Mode w/Net during SR's third party section

Post by Xander »

This is working...however, UVK isn't restarting itself when it does.

What would be a good way to ensure it restarts? Add a fix that creates a reg entry to RunOnce? And how would you add the UVKSR to it since that includes the username? Or one that calls the RebootExec app?
Charger440
Posts: 1529
Joined: Sun May 25, 2014 7:44 am
Location: Missouri

Re: Reboot to Safe Mode w/Net during SR's third party section

Post by Charger440 »

Xander,

At one point it did use the registry to start up but that ran into problems so Fred moved it to the startup folder.

Maybe it might could be tried again.
Jim

It is not "Can it be done?" but rather, "How can we do it?"
Xander
Posts: 438
Joined: Sun May 24, 2015 11:55 pm
Contact:

Re: Reboot to Safe Mode w/Net during SR's third party section

Post by Xander »

Weird thing is (I've been experimenting with it tonight) is that it's just inconsistent. It has started itself the last three times but missed the two before that.

Incidentally, the commands from the first post are working much better now that I've added "Wait for child processes" and a 3rd command of just "notepad" (which doesn't close itself thus preventing UVK from steamrolling on and allowing the shutdown to happen).
Fred
Site Admin
Posts: 2357
Joined: Sat Jul 30, 2011 12:05 pm
Location: Red coast, France
Contact:

Re: Reboot to Safe Mode w/Net during SR's third party section

Post by Fred »

I was working fine the last time I tried it. If the repair operation doesn't restart, you can manually do it by executing the ContinueRepair_[UserName].uvksr.

The operation only continues if the logged-in user is the same as the one when the repair operation was started.

If you log in from a different account the repair operation does not start. In that case, you can manually start the operation as explained above, but it is not recommended, as some fixes are user related.
One thing we humans have in common is that we are all different. So, if you think you're weird because you're different from everyone else, then we are all weird.

Fred
Xander
Posts: 438
Joined: Sun May 24, 2015 11:55 pm
Contact:

Re: Reboot to Safe Mode w/Net during SR's third party section

Post by Xander »

Fred wrote:I was working fine the last time I tried it. If the repair operation doesn't restart, you can manually do it by executing the ContinueRepair_[UserName].uvksr.
Yeah, that's what I had to do a few times.

One user with no password so it does an auto-login.

Could UVK be set to run itself no matter what until the program is closed by the tech? This way, even if it's at the Welcome screen when the PC reboots, it will come back up? And, if so, be set so that it runs again even if the PC reboots into Safe Mode.
Fred
Site Admin
Posts: 2357
Joined: Sat Jul 30, 2011 12:05 pm
Location: Red coast, France
Contact:

Re: Reboot to Safe Mode w/Net during SR's third party section

Post by Fred »

I guess I could add that as an extra option, exportable to UVKSettings.ini. Not as a standard option, obviously. I'll see what I can come up with.
One thing we humans have in common is that we are all different. So, if you think you're weird because you're different from everyone else, then we are all weird.

Fred
Xander
Posts: 438
Joined: Sun May 24, 2015 11:55 pm
Contact:

Re: Reboot to Safe Mode w/Net during SR's third party section

Post by Xander »

Any follow-up on this?

Just working on another laptop and, once it got into safe mode, had to go into the Startup folder. What about creating a shortcut on the desktop for continuing and then UVK can remove it when the list is done?

Isn't there a RunOnce section that works in Safe Mode?
Fred
Site Admin
Posts: 2357
Joined: Sat Jul 30, 2011 12:05 pm
Location: Red coast, France
Contact:

Re: Reboot to Safe Mode w/Net during SR's third party section

Post by Fred »

Xander wrote:Isn't there a RunOnce section that works in Safe Mode?
Not exactly a "section". RunOnce entries are prefixed with an asterisk to run in safe mode. That's exactly what the Reboot in safe mode and continue fix does. https://msdn.microsoft.com/en-us/librar ... s.85).aspx

That's also how it used to work in general, but there's a problem with that: RunOnce entries are handled by the shell, and as a consequence, if the File Explorer was restarted during a fix, it would launch the Continue repair operation before rebooting. Now this is even more annoying, so I used the startup folder.

If you reboot in safe mode using your own UVKSR app, it won't work, because the "asterisked" RunOnce entry was not created. It only works with the Reboot in safe mode and continue fix.

I'm currently coding the Log Analyzer in C++, and then I will do the same to UVK_en. Once I got the Log analyzer ready, I will just add the UVK requested features that won't take long to add. I don't want to waste much time with AutoIt, and then have to recode everything in C++.

I like you desktop shortcut idea better that the autorun antry. It's far less intrusive, and UVK can delete it once the repair operation is restarted. I'll do that for the next update.
One thing we humans have in common is that we are all different. So, if you think you're weird because you're different from everyone else, then we are all weird.

Fred
Xander
Posts: 438
Joined: Sun May 24, 2015 11:55 pm
Contact:

Re: Reboot to Safe Mode w/Net during SR's third party section

Post by Xander »

Any thoughts on "autostart until we close the program"; until we actually have to "X" out the program to fully close it? UVK could put itself on the asterisked list on its startup and remove itself on its shutdown.
Fred
Site Admin
Posts: 2357
Joined: Sat Jul 30, 2011 12:05 pm
Location: Red coast, France
Contact:

Re: Reboot to Safe Mode w/Net during SR's third party section

Post by Fred »

The problem with asterisked, or normal RunOnce entries, as I mentioned above is that they are handled by the shell, and if the Windows file explorer restarts, the RunOnce entry is executed. Since that may happen often during a repair operation, it may become an issue.

That's why I'd rather just create a desktop shortcut to continue the repair operation. But even that may be an issue, if someone double-clicks the shortcut while the operation is still in progress. I'll have to think that over.
One thing we humans have in common is that we are all different. So, if you think you're weird because you're different from everyone else, then we are all weird.

Fred
Xander
Posts: 438
Joined: Sun May 24, 2015 11:55 pm
Contact:

Re: Reboot to Safe Mode w/Net during SR's third party section

Post by Xander »

Could it run as a service?
Fred
Site Admin
Posts: 2357
Joined: Sat Jul 30, 2011 12:05 pm
Location: Red coast, France
Contact:

Re: Reboot to Safe Mode w/Net during SR's third party section

Post by Fred »

Win32 services don't execute in safe mode, nor do scheduled tasks. I know it's possible to make a service run in safe mode, but that procedure is detected as malware activity by most AV software. Can't really blame them. That's not the intended use of the safe mode, or it becomes 'unsafe' mode.

Which leaves us with the asterisked RunOnce entry for the "Reboot in safe mode and continue" fix, and the Startup folder shortcut, if the computer is rebooted before the repair operation completes.

We could make RebootExec run as a service while the repair operation is being performed, and make it restart UVK if it is closed by other application. Not sure that would work either, as the other application would probably kill the RebootExec process too.
One thing we humans have in common is that we are all different. So, if you think you're weird because you're different from everyone else, then we are all weird.

Fred
Post Reply