<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>check for pending restart Archives - the Sysadmin Channel</title>
	<atom:link href="https://thesysadminchannel.com/tag/check-for-pending-restart/feed/" rel="self" type="application/rss+xml" />
	<link>https://thesysadminchannel.com/tag/check-for-pending-restart/</link>
	<description>Documenting My Life as a System Administrator</description>
	<lastBuildDate>Tue, 10 Aug 2021 00:39:59 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.8.3</generator>
<site xmlns="com-wordpress:feed-additions:1">144174110</site>	<item>
		<title>Check Pending Reboot Status Using Powershell</title>
		<link>https://thesysadminchannel.com/remotely-check-pending-reboot-status-powershell/</link>
					<comments>https://thesysadminchannel.com/remotely-check-pending-reboot-status-powershell/#comments</comments>
		
		<dc:creator><![CDATA[Paul Contreras]]></dc:creator>
		<pubDate>Wed, 08 Aug 2018 06:57:11 +0000</pubDate>
				<category><![CDATA[Powershell]]></category>
		<category><![CDATA[check for pending reboot windows 10]]></category>
		<category><![CDATA[check for pending restart]]></category>
		<category><![CDATA[check pending reboot powershell]]></category>
		<category><![CDATA[How to Check if a Server Needs a Reboot]]></category>
		<category><![CDATA[powershell check pending reboot remote computer]]></category>
		<category><![CDATA[powershell pending reboot remote computer]]></category>
		<category><![CDATA[wmi check pending reboot powershell]]></category>
		<guid isPermaLink="false">https://thesysadminchannel.com/?p=885</guid>

					<description><![CDATA[<p>In the world of system administration, you will eventually have a need to check if a server needs a reboot or simply check pending reboot status. After some scouring on the internet I&#8217;ve come up with a Powershell script to&#8230; <a href="https://thesysadminchannel.com/remotely-check-pending-reboot-status-powershell/" class="more-link">Continue Reading <span class="meta-nav">&#8594;</span></a></p>
<p>The post <a href="https://thesysadminchannel.com/remotely-check-pending-reboot-status-powershell/">Check Pending Reboot Status Using Powershell</a> appeared first on <a href="https://thesysadminchannel.com">the Sysadmin Channel</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>In the world of system administration, you will eventually have a need to check if a server needs a reboot or simply <strong>check pending reboot status</strong>.  After some scouring on the internet I&#8217;ve come up with a Powershell script to let me know if a server needs a reboot.  The best part about it, is that it can all be done remotely.  No need to RDP into multiple servers or computers and do it manually.  Also, it will tell you an easy True or False if it needs a reboot. Let&#8217;s move on to the script.</p>
<p><em>If you have any questions feel fee to leave a comment and I&#8217;ll do my best to get back to you!</em></p>
<h2>Remotely Check Pending Reboot Status Powershell Script</h2>
<pre class="brush: powershell; title: ; notranslate">

Function Get-PendingRebootStatus {
&lt;#
.Synopsis
    This will check to see if a server or computer has a reboot pending.
    For updated help and examples refer to -Online version.
 
.NOTES
    Name: Get-PendingRebootStatus
    Author: theSysadminChannel
    Version: 1.2
    DateCreated: 2018-Jun-6
 
.LINK
    https://thesysadminchannel.com/remotely-check-pending-reboot-status-powershell -
 
 
.PARAMETER ComputerName
    By default it will check the local computer.
 
.EXAMPLE
    Get-PendingRebootStatus -ComputerName PAC-DC01, PAC-WIN1001
 
    Description:
    Check the computers PAC-DC01 and PAC-WIN1001 if there are any pending reboots.
#&gt;
 
    [CmdletBinding()]
    Param (
        [Parameter(
            Mandatory = $false,
            ValueFromPipeline = $true,
            ValueFromPipelineByPropertyName = $true,
            Position=0
        )]
 
    [string[]]  $ComputerName = $env:COMPUTERNAME
    )
 
 
    BEGIN {}
 
    PROCESS {
        Foreach ($Computer in $ComputerName) {
            Try {
                $PendingReboot = $false
 
                $HKLM = [UInt32] &quot;0x80000002&quot;
                $WMI_Reg = [WMIClass] &quot;\\$Computer\root\default:StdRegProv&quot;
 
                if ($WMI_Reg) {
                    if (($WMI_Reg.EnumKey($HKLM,&quot;SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\&quot;)).sNames -contains 'RebootPending') {$PendingReboot = $true}
                    if (($WMI_Reg.EnumKey($HKLM,&quot;SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\&quot;)).sNames -contains 'RebootRequired') {$PendingReboot = $true}
 
                    #Checking for SCCM namespace
                    $SCCM_Namespace = Get-WmiObject -Namespace ROOT\CCM\ClientSDK -List -ComputerName $Computer -ErrorAction Ignore
                    if ($SCCM_Namespace) {
                        if (([WmiClass]&quot;\\$Computer\ROOT\CCM\ClientSDK:CCM_ClientUtilities&quot;).DetermineIfRebootPending().RebootPending -eq $true) {$PendingReboot = $true}
                    }
 
                    [PSCustomObject]@{
                        ComputerName  = $Computer.ToUpper()
                        PendingReboot = $PendingReboot
                    }
                }
            } catch {
                Write-Error $_.Exception.Message
 
            } finally {
                #Clearing Variables
                $null = $WMI_Reg
                $null = $SCCM_Namespace
            }
        }
    }
 
    END {}
}

</pre>
<p><a href="https://thesysadminchannel.com/wp-content/uploads/2018/08/Get-PendingRebootstatus.png" target="_blank" rel="noopener noreferrer"><img fetchpriority="high" decoding="async" src="https://thesysadminchannel.com/wp-content/uploads/2018/08/Get-PendingRebootstatus.png" alt="Get-PendingRebootStatus" width="859" height="453" class="aligncenter size-full wp-image-937" srcset="https://thesysadminchannel.com/wp-content/uploads/2018/08/Get-PendingRebootstatus.png 859w, https://thesysadminchannel.com/wp-content/uploads/2018/08/Get-PendingRebootstatus-768x405.png 768w" sizes="(max-width: 859px) 100vw, 859px" /></a></p>
<h3>How to run the Get-PendingRebootStatus script</h3>
<p>In order to the run the script there are a couple of things you need to do.  First and foremost, you need to <a href="https://thesysadminchannel.com/set-execution-policy-in-powershell/" target="_blank" rel="noopener noreferrer">set your execution policy</a> to RemoteSigned.  This is a standard with running <em>any</em> Powershell script.</p>
<p>Next you need to dot source the script since it is a function.  To dot source the script do the following:</p>
<ul>
<li>Copy the script above and save it any location. In this example I&#8217;ll save it to my C:\_Scripts folder.</li>
<li>Within the Powershell Window type: <strong>. .\_Scripts\Get-PendingRebootStatus.ps1 </strong>&#8211; Note the two dots before the backslash.</li>
</ul>
<p><a href="https://thesysadminchannel.com/wp-content/uploads/2018/08/Dot-Source-Get-PendingRebootstatus.png" target="_blank" rel="noopener noreferrer"><img decoding="async" src="https://thesysadminchannel.com/wp-content/uploads/2018/08/Dot-Source-Get-PendingRebootstatus.png" alt="Dot-Source Get-PendingRebootstatus" width="859" height="452" class="aligncenter size-full wp-image-939" srcset="https://thesysadminchannel.com/wp-content/uploads/2018/08/Dot-Source-Get-PendingRebootstatus.png 859w, https://thesysadminchannel.com/wp-content/uploads/2018/08/Dot-Source-Get-PendingRebootstatus-768x404.png 768w" sizes="(max-width: 859px) 100vw, 859px" /></a><br />
&nbsp;</p>
<p>Hopefully this article has helped you check pending Reboot status for machines in your environment.  Let me know what you think.  Also, consider subscribing to our <a href="https://www.youtube.com/channel/UC9VnUjmZrNG3ithDZmG-S-g" rel="noopener noreferrer" target="_blank">Youtube Channel</a> to get video demos and other related sysadmin content.  While you&#8217;re at it, don&#8217;t forget to take a look at our other real world <a href="https://thesysadminchannel.com/powershell/" rel="noopener" target="_blank">Powershell Scripts</a>.</p>
<p>The post <a href="https://thesysadminchannel.com/remotely-check-pending-reboot-status-powershell/">Check Pending Reboot Status Using Powershell</a> appeared first on <a href="https://thesysadminchannel.com">the Sysadmin Channel</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://thesysadminchannel.com/remotely-check-pending-reboot-status-powershell/feed/</wfw:commentRss>
			<slash:comments>13</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">885</post-id>	</item>
	</channel>
</rss>
