![]() ![]() To restart the operating system, use the Restart-Computer command Restart-Computer To shut down the computer, use the Stop-Computer command Stop-Computer You can also perform shutdown and restart operations directly from PowerShell. Tsshutdn.exe or shutdown.exe with appropriate arguments. Windows includes two command-line tools for restarting a computer. Most command-line tools support bothĪctions. Shutting down and restarting computers are similar tasks. Get-CimInstance -ClassName Win32_OperatingSystem | Invoke-CimMethod -MethodName Shutdown Invoking the method with the 0 flag initiates logoff:įor more information, see the Shutdown method of the Win32_OperatingSystem class. The Win32_OperatingSystem class has a Shutdown method. You can also use the shutdown.exe tool with its logoff option: shutdown.exe -lĪnother option is to use WMI. To log off the current active session, type logoff Way is to use the Remote Desktop/Terminal Services command-line tool, logoff.exe (For details,Īt the PowerShell prompt, type logoff /?). You can use several different techniques to log off of a session on the local system. To shut down particular sessions on a Terminal Server, use the tsshutdn.exe command-line tool. When you lock a workstation while Fast User Switching is enabled, such as on Windows XP, theĬomputer displays the user logon screen rather than starting the current user's screensaver. This command immediately locks the workstation. LockWorkstation() function in user32.dll: rundll32.exe user32.dll,LockWorkStation The only way to lock a computer directly with the standard available tools is to call the State in PowerShell illustrates some of the important details about working with external tools in To reset a computer in PowerShell, use either a standard command-line tool, WMI, or a CIM class.Īlthough you are using PowerShell only to run the tool, learning how to change a computer's power
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |