Shutdown / Restart computer with comment

This topic contains 4 replies, has 4 voices, and was last updated by Profile photo of Don Jones Don Jones 2 years, 2 months ago.

  • Author
    Posts
  • #18695
    Profile photo of Mario
    Mario
    Participant

    When I shutdown a server using the GUI (Start -> Shutdown) , there is a comment box that allows you to enter comments.

    I don't see a parameter to specify a comment with the Shutdown-Computer or Restart-Computer cmdlets.

    Does anyone know of an alternative way to specify comments when shutting down / restarting a server via PowerShell

  • #18696
    Profile photo of Greg Altman
    Greg Altman
    Member

    The best I could figure out was following this discussion: http://social.technet.microsoft.com/Forums/en-US/b9ef6b0f-ffa2-4521-8771-6a70727dff2b/how-to-invoke-the-shutdown-event-tracker-when-running-restartcomputer?forum=winserverpowershell

    In a nutshell use the native Shutdown command with a /c switch.....

  • #18698
    Profile photo of Mario
    Mario
    Participant

    Thanks Greg. This helps.Looks like I'll need to use shutdown.exe for now.

    It would be nice if the PowerShell cmdlets would provide full fidelity with their old command-line counterparts. Oh well – maybe in a future version.

    Thanks,
    Mario

  • #18701
    Profile photo of Jason Hofferle
    Jason Hofferle
    Participant

    Sounds like a good feature request to add on connect: http://connect.microsoft.com/PowerShell

  • #18716
    Profile photo of Don Jones
    Don Jones
    Keymaster

    Stop- and Restart-Computer aren't technically counterparts to Shutdown.exe. They accomplish a similar task, but through completely different APIs – and it's the underlying APIs, in this case, that don't readily support sending the notification. Jason's correct in that a Connect ticket would be the best way to ask for the functionality. Keep in mind that the PowerShell team doesn't "own" the entire API stack, so sometimes they're limited in what they can provide us.

    Which is also why PowerShell enables you to user external command-line utilities. No reason not to use Shutdown.exe, really, if it's what does the job.

You must be logged in to reply to this topic.