Recently, there has been a problem with the notebook. The computer sleep is just a black screen, so it can’t enter the standby (S3) state. After I couldn’t find the reason by querying powercfg, I suddenly thought it might beDeparture modeIn trouble. As a win10 user who loves command line, he doesn’t need regedit.
When I look up the data of opening PowerShell, I find that the way PowerShell modifies the registry is similar to operating the file directory, and the key in the directory is the property of the directory.
The first step to modify the registry is to enter the virtual drive. HKEY? Local? Machine corresponds to HKLM
Set-Location HKLM:
To display the directories in HKEY? Local? Machine, you can also use theGet-ChildItem
(ls
)
To remove the leave mode, we enter theHKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager
, the corresponding directory isHKLM:\SYSTEM\CurrentControlSet\Control\Session Manager
Set-Location "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager"
Away modeenabled is just a property of power
> Get-ItemProperty power
......
KernelResumeIoCpuTime : 0
HiberIoCpuTime : 0
HybridBootAnimationTime : 1524
ResumeCompleteTimestamp : 105335390
AwayModeEnabled : 1
......
> Get-ItemProperty power | Select-Object AwayModeEnabled
AwayModeEnabled
---------------
1
It’s also easy to delete this one
Remove-ItemProperty Power -Name AwayModeEnabled
To summarize,A commandCloseDeparture mode
Remove-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Power" -Name AwayModeEnabled
Of course, you can add it back. The order is here
New-ItemProperty Power -Name AwayModeEnabled -Value 1