@@ -26,13 +26,18 @@ function Invoke-UpdateCheck
26
26
27
27
The Git repo for this module can be found here: http://aka.ms/PowerShellForGitHub
28
28
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
+
29
33
. EXAMPLE
30
34
Invoke-UpdateCheck
31
35
32
36
. NOTES
33
37
Internal-only helper method.
34
38
#>
35
- param ()
39
+ [cmdletbinding ()]
40
+ param ([switch ] $Force )
36
41
37
42
if (Get-GitHubConfiguration - Name DisableUpdateCheck)
38
43
{
@@ -44,6 +49,18 @@ function Invoke-UpdateCheck
44
49
45
50
$jobNameToday = " Invoke-UpdateCheck-" + (Get-Date - format ' yyyyMMdd' )
46
51
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
+
47
64
# We only check once per day
48
65
if ($jobNameToday -eq $script :UpdateCheckJobName )
49
66
{
@@ -83,7 +100,7 @@ function Invoke-UpdateCheck
83
100
if ($script :HasLatestVersion )
84
101
{
85
102
$message = " [$moduleName ] update check complete. Running latest version: $latestVersion "
86
- Write-Log = Message $message - Level Verbose
103
+ Write-Log - Message $message - Level Verbose
87
104
}
88
105
elseif ($moduleVersion -gt $latestVersion )
89
106
{
@@ -132,6 +149,9 @@ function Invoke-UpdateCheck
132
149
133
150
try
134
151
{
152
+ # Disable Progress Bar in function scope during Invoke-WebRequest
153
+ $ProgressPreference = ' SilentlyContinue'
154
+
135
155
Invoke-WebRequest @params
136
156
}
137
157
catch
0 commit comments