Closed That-Annoying-Guy closed 7 months ago
Steps to reproduce:
Install-Module -Name IntuneWin32App Test-AccessToken
Result:
You cannot call a method on a null-valued expression. At C:\Program Files\WindowsPowerShell\Modules\IntuneWin32App\1.4.3\Public\Test-AccessToken.ps1:32 char:9 + $TokenExpireMinutes = [System.Math]::Round(([datetime]$Global ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [], RuntimeException + FullyQualifiedErrorId : InvokeMethodOnNull False
Cause: $Global:AccessToken doesn't exists because Connect-MSIntuneGraph must be used to create it.
$Global:AccessToken
Connect-MSIntuneGraph
Solution: In Test-AccessToken.ps1, add something like at the top of Process section
Test-AccessToken.ps1
If ($null -eq $Global:AccessToken) { return $false }
Good catch, added in 1.4.4. Thanks!
Steps to reproduce:
Result:
Cause:
$Global:AccessToken
doesn't exists becauseConnect-MSIntuneGraph
must be used to create it.Solution: In
Test-AccessToken.ps1
, add something like at the top of Process section