Giter Site home page Giter Site logo

pendingreboot's Introduction

PendingReboot

Build Status

Module to detect Windows OS pending reboots.

This module leverages WMI in order to query the Registry for various pending reboot detections.

How to use

Deploy the PendingReboot folder from the Release folder to your PSModulePath, i.e. PendingReboot and PowerShell will automatically find/load the module.

This module is also published on the PowerShell Gallery, so installing it via PowerShell is an option:

Install-Module -Name PendingReboot

Functions

  • Test-PendingReboot Test the pending reboot status on a local and/or remote computer.

Test-PendingReboot

  • ComputerName: A single computer name or an array of computer names. The default is localhost ($env:COMPUTERNAME).
  • Credential: Specifies a user account that has permission to perform this action. The default is the current user. Type a username, such as User01, Domain01\User01, or [email protected]. Or, enter a PSCredential object, such as an object that is returned by the Get-Credential cmdlet. When you type a user name, you are prompted for a password.
  • Detailed: Indicates that this function returns a detailed result of pending reboot information, why the system is pending a reboot, not just a true/false response.
  • SkipConfigurationManagerClientCheck: Indicates that this function will not test the Client SDK WMI class that is provided by the System Center Configuration Manager Client. This parameter is useful when SCCM is not used/installed on the targeted systems.
  • SkipPendingFileRenameOperationsCheck: Indicates that this function will not test the PendingFileRenameOperations MultiString Value property of the Session Manager registry key. This parameter is useful for eliminating possible false positives. Many Anti-Virus packages will use the PendingFileRenameOperations MultiString Value in order to remove stale definitions and/or .dat files.

Versions

0.9.0.6

  • Fixed a bug when querying multiple computers with different values returned unexpected results.
    • Updated Pester test to account for this type of issue.

0.9.0.5

  • Added appveyor, build script and psdeploy

0.9.0.0

  • Initial Release with major changes from the TechNet Gallery
    • The function/module received a major overhaul since coming over from the technet gallary.
    • The function is no longer called "Get-PendingReboot", instead "Test-PendingReboot" is more appropriate.
    • Breaking Change Test-PendingReboot has all new property names to be more inline with what it is testing.
    • New Parameters were introduced:
      • SkipConfigurationManagerClientCheck - Allows users to skip the CCM Client SDK WMI query, since not all systems will have an SCCM Agent installed.
      • SkipPendingFileRenameOperations - Allows users to skip the PendingFileRenameOperations check, since this MultiString Value generates false-positives.
      • Credential - By popular demand, this parameter will allow the user to connect with alternate credentials.

Examples

Test the pending reboot status of the local computer

PS C:\> Test-PendingReboot

ComputerName IsRebootPending
------------ ---------------
WKS01                   True

Test the pending reboot status of a local computer, returning only a bool value

PS C:\> (Test-PendingReboot).IsRebootPending
True

Test the pending reboot status of a remote computer called 'DC01' and return detailed information

PS C:\> Test-PendingReboot -ComputerName DC01 -Detailed

ComputerName                     : dc01
ComponentBasedServicing          : True
PendingComputerRenameDomainJoin  : False
PendingFileRenameOperations      : False
PendingFileRenameOperationsValue :
SystemCenterConfigManager        : False
WindowsUpdateAutoUpdate          : True
IsRebootPending                  : True

Test the pending reboot status of a remote computer called 'DC01', with detialed information, skipping System Center Configuration Manager Agent and PendingFileRenameOperation Checks

PS C:\> Test-PendingReboot -ComputerName DC01 -SkipConfigurationManagerClientCheck -SkipPendingFileRenameOperationsCheck -Detailed

CommputerName                    : dc01
ComponentBasedServicing          : True
PendingComputerRenameDomainJoin  : False
PendingFileRenameOperations      : False
PendingFileRenameOperationsValue :
SystemCenterConfigManager        :
WindowsUpdateAutoUpdate          : True
IsRebootPending                  : True

pendingreboot's People

Contributors

bcwilhite avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pendingreboot's Issues

powershell 64 bit vs powershell x86 return different results

Hello,

First thanks for this tool it is helpful. I may not be able to use it though. I am not sure if this is by design or not, but AFTER windows update on a windows server 2016 enterprise when I run Test-PendingReboot I get different results when I run in PS x86 compared to the 64bit version. the PS x86 is wrong.

Switch to CIM cmdlets

Hi Brian! As far as I know, WMI cmdlets are considered deprecated. Do you think it's worth to switch to CIM cmdlets? Or implement both and let users to choose which one to use via a switch parameter?

Detecting Reboot Pending From Install/Uninstall-WindowsFeature

This case does not seem to be handled.
I have done the research on how to detect it, but it is based on greping file contents or running Uninstall-feature against something innocuous.
I'm not sure if that is in scope for this code since everything in it is currently doable by remote registry calls.
Can you please comment on approach and I will know whether I have the time to do a pull request.

Have you seen this one on your Pending Reboot PSD1

I have an issue maybe you can shed some light on... I have many different versions of PS so I think the best way to get this deployed to 10k+ machines is to copy the files and then run a import-module on it. But when I copy the folder to the powershell module location and try to run the psd1 I get a

Import-LocalizedData : Cannot find the Windows PowerShell data file 'PendingReboot.strings.psd1' in directory 'C:\Program
Files\WindowsPowerShell\Modules\PendingReboot\Private\Docs\en-US\en-US', or in any parent culture directories.
At C:\Program Files\WindowsPowerShell\Modules\PendingReboot\Private_localizationHeader.ps1:1 char:25

  • $script:localizedData = Import-LocalizedData -BaseDirectory "$PSScriptRoot\Docs\ ...
  •   + CategoryInfo          : ObjectNotFound: (C:\Program File...ot.strings.psd1:String) [Import-LocalizedData], PSInvalidOperationException
      + FullyQualifiedErrorId : ImportLocalizedData,Microsoft.PowerShell.Commands.ImportLocalizedData
    

What I see is in the path for the import-localizeddata it shows a path which included en-us\en-us (twice) so I have looked in all the files that are apparent to see if there is something in a path that is an issue but coming up blank... any pointers>

Interestingly enough I have found if I run the Import-Module manually 2 times it will work the second time but I am trying to get this to work in a SCCM TS and in that it doesn't work if I run it twice :)

Thanks

UpdateExeVolatile

Hi.

I found an article that indicates another registry key that determines if a modification to an EXE is pending that's missing from this module:
https://scriptingetc.wordpress.com/2017/06/16/detect-pending-reboots/

Pending EXE Modification

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Updates\UpdateExeVolatile
Any non-zero value indicates a pending reboot

More information can be found here:
http://support.microsoft.com/kb/832475

The registry key should probably also be checked:
HKLM\SOFTWARE\Wow6432Node\Microsoft\Updates\UpdateExeVolatile

Thank you.

-Examples

When running the get-help. It would be nice to see the syntax examples. It would also be nice to have more detail listed.

Credential window popup on PowerShell 2 and 3

Hello - it seems on PowerShell 2 and 3 (haven't tested 4) that we get a popup asking for credentials even if we don't specify that parameter (just the Test-PendingReboot function without any parameters). I've commented out the parameter to bypass this, just wondering if you knew about it or if any other fix was available.

`PendingComputerRenameDomainJoin` always `$true`

hi,
i'd like to report a small bug i have. PendingComputerRenameDomainJoin is always $true for my notebook, for some reason unknown to me. nothing is pending in reality.
here's some info:

 > get-module PendingReboot

ModuleType Version    PreRelease Name                                ExportedCommands
---------- -------    ---------- ----                                ----------------
Script     0.9.0.6               PendingReboot                       Test-PendingReboot
 > $PSVersionTable
Name                           Value
----                           -----
PSVersion                      7.3.6
PSEdition                      Core
GitCommitId                    7.3.6
OS                             Microsoft Windows 10.0.22631
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0


[pwsh_7.1.0] Invoke-WmiMethod is not recognized as a name of a cmdlet

Running Test-PendingReboot in Powershell 7.1.0 returns

The term 'Invoke-WmiMethod' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.