Author Posts

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.

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.

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

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

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

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

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

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