MSEndpointMgr / IntuneWin32App

Provides a set of functions to manage all aspects of Win32 apps in Microsoft Intune.
MIT License
351 stars 91 forks source link

Bug - Authentication Header not working on MacOS #182

Open pcdiks opened 1 month ago

pcdiks commented 1 month ago

I have installed the latest version of intuneWin32App and updated my local powershell modules to the latest versions. I am running powershell 7.4.5 on MacOS Sequoia 15.0.1.

After connecting to the environment with Connect-MSIntuneGraph -TenantId -clientid -ClientSecret , which works fine, I get an error message when I run: Get-IntuneWin32App.

The error is:

ConvertFrom-Json: /Users/pcd/.local/share/powershell/Modules/IntuneWin32App/1.4.4/Private/Invoke-MSGraphOperation.ps1:189
Line |
 189 |  … ErrorDetails = $ExceptionItem.ErrorDetails.Message | ConvertFrom-Json
     |                                                         ~~~~~~~~~~~~~~~~
     | Cannot bind argument to parameter 'InputObject' because it is null.

After some troubleshooting I found a fix, I have to remove the ExpiresOn from the AuthenticationHeader hashtable. If I do that, then it works.

Running the same command on a recent Windows 11 machine works fine.

The problem occurs in the Invoke-MSGraphOperation.ps1 script on line 141. If I run that line without the try/catch I get this error:

[DBG]: PS /Users/pcd/.local/share/powershell/Modules/IntuneWin32App> Invoke-RestMethod @RequestParams -verbose
Requested HTTP/1.1 GET with 0-byte payload
Invoke-RestMethod: Request headers must contain only ASCII characters.