@@ -26,13 +26,18 @@ function Invoke-UpdateCheck
2626
2727 The Git repo for this module can be found here: http://aka.ms/PowerShellForGitHub
2828
29+ . PARAMETER Force
30+ For debugging purposes, using this switch will allow the check to occur more than the limit
31+ of once per day. This _will not_ bypass the DisableUpdateCheck configuration value however.
32+
2933 . EXAMPLE
3034 Invoke-UpdateCheck
3135
3236 . NOTES
3337 Internal-only helper method.
3438#>
35- param ()
39+ [cmdletbinding ()]
40+ param ([switch ] $Force )
3641
3742 if (Get-GitHubConfiguration - Name DisableUpdateCheck)
3843 {
@@ -44,6 +49,18 @@ function Invoke-UpdateCheck
4449
4550 $jobNameToday = " Invoke-UpdateCheck-" + (Get-Date - format ' yyyyMMdd' )
4651
52+ if ($Force )
53+ {
54+ if ($null -ne $script :UpdateCheckJobName )
55+ {
56+ # We're going to clear out the existing job and try running it again.
57+ $null = Receive-Job - Name $script :UpdateCheckJobName - AutoRemoveJob - Wait - ErrorAction SilentlyContinue - ErrorVariable errorInfo
58+ }
59+
60+ $script :UpdateCheckJobName = $null
61+ $script :HasLatestVersion = $null
62+ }
63+
4764 # We only check once per day
4865 if ($jobNameToday -eq $script :UpdateCheckJobName )
4966 {
@@ -83,7 +100,7 @@ function Invoke-UpdateCheck
83100 if ($script :HasLatestVersion )
84101 {
85102 $message = " [$moduleName ] update check complete. Running latest version: $latestVersion "
86- Write-Log = Message $message - Level Verbose
103+ Write-Log - Message $message - Level Verbose
87104 }
88105 elseif ($moduleVersion -gt $latestVersion )
89106 {
@@ -132,6 +149,9 @@ function Invoke-UpdateCheck
132149
133150 try
134151 {
152+ # Disable Progress Bar in function scope during Invoke-WebRequest
153+ $ProgressPreference = ' SilentlyContinue'
154+
135155 Invoke-WebRequest @params
136156 }
137157 catch
0 commit comments