dataplat / dbatools

🚀 SQL Server automation and instance migrations have never been safer, faster or freer
https://dbatools.io
MIT License
2.39k stars 788 forks source link

Update-DbaInstance not handling NoPendingRenameCheck switch correctly #9219

Open JogchumRooda opened 5 months ago

JogchumRooda commented 5 months ago

Verified issue does not already exist?

I have searched and found no existing issue

What error did you receive?

While updating SQL Instances using Updata-DbaInstance the console log shows a warning that there is pending reboot check. The verbose log shows there is a reboot pending in the PendingFileRenameOperations registry values: VERBOSE: [10:09:42][Test-PendingReboot] Reboot pending in the PendingFileRenameOperations registry value WARNING: [10:09:42][Update-DbaInstance] %SERVERFQDN% is pending a reboot. Reboot the computer before proceeding.

I've reviewed and acknowledged that setup can continue (it works manually) without rebooting and therefore added the -NoPendingRenameCheck switch to skip the check. Command looks like this: ` $update = Update-DbaInstance -ComputerName $HostName -Path "$TempLocationLocal\$PatchApplicableFile" -Verbose -NoPendingRenameCheck -ArgumentList "/SkipRules=RebootRequiredCheck"

Still the warning about the same pending reboot is coming forward. Also tried to set dbatools config with Set-DbatoolsConfig -FullName 'OS.PendingRename' -Value $true But still doesn't work.

Steps to Reproduce

# provide your command(s) executed pertaining to dbatools
# please include variable values (redacted or fake if needed) for reference

$TempLocationLocal = 'C:\Temp' $PatchApplicableFile = 'SQLServer2019-KB5031908-x64' $HostName = 'VM01'

$update = Update-DbaInstance -ComputerName $HostName -Path "$TempLocationLocal\$PatchApplicableFile" -Verbose -NoPendingRenameCheck -ArgumentList "/SkipRules=RebootRequiredCheck"

Please confirm that you are running the most recent version of dbatools

2.1.6

Other details or mentions

Tried to figure out the issue ourselves. I feel like the switch is not correctly passed through to the Test-PendingReboot function that handles the check. Could not find the file in the module path so can't point out any mistakes

What PowerShell host was used when producing this error

Windows PowerShell (powershell.exe)

PowerShell Host Version

Name Value


PSVersion 5.1.14393.6343
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.14393.6343
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

SQL Server Edition and Build number

Microsoft SQL Server 2019 (RTM-CU22) (KB5027702) - 15.0.4322.2 (X64) Jul 27 2023 18:11:00 Copyright (C) 2019 Microsoft Corporation Developer Edition (64-bit) on Windows Server 2019 Datacenter 10.0 (Build 17763: ) (Hypervisor)

.NET Framework Version

.NET Framework 4.8.4645.0