0

In windows 10, instead of doing a full reboot, it's convenient to do a partial reboot by login out and login in again, for instance to reload a certain set of drivers and OS user related data. I can do a full reboot with restart-computer, but that's not what I want. I am looking for a fast cycle and the effects of a logoff-login cycle (on drivers and userworld in particular).

  • Is there a way to achieve this quick reboot by the mean of one powershell script ? In particular, I do not want to have to specify again which user (local user) and the password.
  • More technically, I know that a few drivers are unloaded and then reloaded in the "logoff-login" cycle; would that be called a fast kernel reboot ?

A certain edition of Windows server (Azure Stack HCI) allows kernel soft reboot (https://learn.microsoft.com/en-us/azure-stack/hci/manage/kernel-soft-reboot), this is not what I am looking for.

Soleil
  • 428

1 Answers1

1

My understanding is that you wish to automatically logoff and then login back as the same user. This is impossible in one PowerShell script, as it would be terminated by the logoff, but there is a trick.

The trick is to set your account to be auto-login and then logout. You would then be automatically logged back in.

To turn on automatic logon in Windows, see the post How do I change automatic logon via Script or Command Line? You may set the listed registry entries in your PowerShell script, before executing the logoff.

For logoff, see the article Changing computer state. The simplest is to execute the command shutdown.exe -l.

If you have for login a "welcome message", you will still have to click on OK to fully log in.

harrymc
  • 498,455