Pending reboots

This topic contains 7 replies, has 3 voices, and was last updated by  chrodriguez1 4 months, 2 weeks ago.

  • Author
    Posts
  • #91039

    chrodriguez1
    Participant

    I'm trying to see what servers I have that are in the status of "Pending reboot", I run the following:
    $Servers = Get-Content C:\ServerList.txt
    Get-PendingReboot -ComputerName $Servers | Export-CSV C:\Util\PendingRebootReportServers.csv -NoTypeInformation

    but returns this error: Get-PendingReboot : The term 'Get-PendingReboot' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is
    correct and try again.

  • #91042

    Jeremy Corbello
    Participant

    Get-PendingReboot is not a cmdlet. A quick search shows it's a script (see here: https://gallery.technet.microsoft.com/scriptcenter/Get-PendingReboot-Query-bdb79542)
    So what you'll need to do is something like this:

    c:\path\to\Get-PendingReboot.ps1 -ComputerName $Servers | Export-CSV C:\Util\PendingRebootReportServers.csv -NoTypeInformation

    You have tell PowerShell where the script is, so it can run it.

    • #91045

      chrodriguez1
      Participant

      Set-Location : A parameter cannot be found that matches parameter name 'ComputerName'.

    • #91048

      Jeremy Corbello
      Participant

      Your original command didn't show you using Set-Location. What exactly was done that caused that error to pop up?

  • #91043

    Will Anderson
    Keymaster

    Get-PendingReboot is not a standard cmdlet. Do you have a module installed on your machine with this cmdlet in it?

    • #91046

      chrodriguez1
      Participant

      No I don't I though that Import-Module ActiveDirectory would work, do you happen to have one that I should have installed?

    • #91051

      Jeremy Corbello
      Participant

      Let's take a step back. Where did you learn about Get-PendingReboot?

    • #91052

      chrodriguez1
      Participant

      disregard I got it to work by loading this "script" as a "function" by "dot sourcing" the .ps1 file.

You must be logged in to reply to this topic.