Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PendingComputerRenameDomainJoin always $true #14

Open
aetonsi opened this issue Sep 17, 2023 · 3 comments
Open

PendingComputerRenameDomainJoin always $true #14

aetonsi opened this issue Sep 17, 2023 · 3 comments

Comments

@aetonsi
Copy link

aetonsi commented Sep 17, 2023

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


@alayac
Copy link

alayac commented Sep 18, 2023

You should use this module using Windows PowerShell 5.1, not PowerShell 7.x because a lot of the commands within the module are using WMI cmdlets, not the newer CIM cmdlets. The older WMI cmdlets don't work in PS7.

@aetonsi
Copy link
Author

aetonsi commented Sep 24, 2023

hi, i can confirm the bug only appears in pwsh and not powershell. could you add an error message for when the function is run within pwsh? thanks

@ShaneJ7769
Copy link

Those who are coming to look for a work around:

$RebootFlags = Test-PendingReboot -Detailed -WarningAction SilentlyContinue -ErrorAction SilentlyContinue
$JoinFlag = (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired")
$PendingRename = ((Test-Path -Path "HKLM:\SYSTEM\CurrentControlSet\Control\ComputerName\ActiveComputerName") -and ((Get-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName").ComputerName -ne $env:COMPUTERNAME))

if ($RebootFlags.IsRebootPending -eq $true) {
if (($RebootFlags.ComponentBasedServicing -eq $True) -or #($RebootFlags.PendingComputerRenameDomainJoin -eq $True) -or
($RebootFlags.PendingFileRenameOperations -eq $True) -or ($RebootFlags.SystemCenterConfigManager -eq $True) -or
($RebootFlags.WindowsUpdateAutoUpdate -eq $True) -or ($JoinFlag -eq $true) -or
($PendingRename -eq $True)) {
Write-Host "There is a pending reboot needed." -ForegroundColor Red
}}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants