svrooij / WingetIntune

Package any app from Winget to Intune - WinTuner
https://wintuner.app/
GNU General Public License v3.0
136 stars 20 forks source link

[Bug]: PowerShell Deploy fails with "Value cannot be null. (Parameter 's')" #79

Open holnburger opened 5 months ago

holnburger commented 5 months ago

CommandLet

Deploy-WtWin32App

Full command

Deploy-WtWin32App -PackageFolder "/Users/josef/Intune/Zoom.Zoom/6.0.39959" -Username info@example.com

Module version

0.8.8

What happened?

Some deploys fail, apparently because there is a parameter missing in the app.json.

It happened with the following packages:

Zoom.Zoom KeePassXCTeam.KeePassXC Google.Chrome

I used a pipe deploy: New-WtWingetPackage -PackageId "Zoom.Zoom" -PackageFolder "/Users/josef/Intune" | Deploy-WtWin32App -Username "info@example.com" (but it also happened with downloading it first and deploying it with a path to the folder)

Command output

INFO: [IntuneManager] Writing detection info with msi details Google.Chrome {829B647D-A3F1-39D5-B446-9D7EC9AB5705}
INFO: [IntuneManager] Writing package readme for package Google.Chrome
INFO: Loading package details from folder /Users/josef/Intune/Google.Chrome/126.0.6478.57
Deploy-WtWin32App: Value cannot be null. (Parameter 's')

PowerShell version

7.4.2 (on a Mac)

Code of Conduct

svrooij commented 5 months ago

I think it cannot handle the file path, not sure how I can check what happens.

What happens if you add -Debug -Verbose? I'm hoping that will add some logging to the output window.

holnburger commented 5 months ago

Sure:

PS /Users/josef/Intune> New-WtWingetPackage -PackageId "Google.Chrome" -PackageFolder "/Users/josef/Intune" | Deploy-WtWin32App -Username "redacted@redacted.com" -Debug -Verbose
INFO: Packaging package Google.Chrome 126.0.6478.57
INFO: [WingetManager] Getting package info for Google.Chrome 126.0.6478.57 from github
INFO: [IntuneManager] Generating IntuneWin package for Google.Chrome 126.0.6478.57 X64 System in /Users/josef/Intune
INFO: [IntuneManager] Downloading installer from https://dl.google.com/dl/chrome/install/googlechromestandaloneenterprise64.msi to /var/folders/db/w7kxcbqx6mb6zltd2h_0hn1c0000gn/T/wintuner/Google.Chrome/126.0.6478.57/googlechromestandaloneenterprise64.msi
WARNING: [IntuneManager] Unable to get product code from /var/folders/db/w7kxcbqx6mb6zltd2h_0hn1c0000gn/T/wintuner/Google.Chrome/126.0.6478.57/googlechromestandaloneenterprise64.msi because Microsoft.Deployment.WindowsInstaller.dll is not available on Linux
INFO: [Packager] Creating Intune package from /var/folders/db/w7kxcbqx6mb6zltd2h_0hn1c0000gn/T/wintuner/Google.Chrome/126.0.6478.57
INFO: [Packager] Creating package for /var/folders/db/w7kxcbqx6mb6zltd2h_0hn1c0000gn/T/wintuner/Google.Chrome/126.0.6478.57/googlechromestandaloneenterprise64.msi in /var/folders/db/w7kxcbqx6mb6zltd2h_0hn1c0000gn/T/wintuner/Google.Chrome/126.0.6478.57 to /Users/josef/Intune/Google.Chrome/126.0.6478.57
INFO: [Packager] Compressing the source folder /var/folders/db/w7kxcbqx6mb6zltd2h_0hn1c0000gn/T/wintuner/Google.Chrome/126.0.6478.57 to /var/folders/db/w7kxcbqx6mb6zltd2h_0hn1c0000gn/T/1550d387-3ece-40e4-ab4c-62aa5e193d8d/IntuneWinPackage/Contents/IntunePackage.intunewin
INFO: [Packager] Generating application info
INFO: [Packager] Encrypting file /var/folders/db/w7kxcbqx6mb6zltd2h_0hn1c0000gn/T/1550d387-3ece-40e4-ab4c-62aa5e193d8d/IntuneWinPackage/Contents/IntunePackage.intunewin
INFO: [Packager] Generated detection XML file /var/folders/db/w7kxcbqx6mb6zltd2h_0hn1c0000gn/T/1550d387-3ece-40e4-ab4c-62aa5e193d8d/IntuneWinPackage/Metadata/Detection.xml
INFO: [Packager] Done creating package for /var/folders/db/w7kxcbqx6mb6zltd2h_0hn1c0000gn/T/wintuner/Google.Chrome/126.0.6478.57/googlechromestandaloneenterprise64.msi in /var/folders/db/w7kxcbqx6mb6zltd2h_0hn1c0000gn/T/wintuner/Google.Chrome/126.0.6478.57 to /Users/josef/Intune/Google.Chrome/126.0.6478.57
INFO: [IntuneManager] Downloading logo from https://api.winstall.app/icons/Google.Chrome.png
INFO: [DefaultFileManager] Skipping download of https://api.winstall.app/icons/Google.Chrome.png to /Users/josef/Intune/Google.Chrome/logo.png because the file already exists
INFO: [IntuneManager] Writing detection info with msi details Google.Chrome {829B647D-A3F1-39D5-B446-9D7EC9AB5705}
INFO: [IntuneManager] Writing package readme for package Google.Chrome
INFO: Loading package details from folder /Users/josef/Intune/Google.Chrome/126.0.6478.57
Deploy-WtWin32App: Value cannot be null. (Parameter 's')

Maybe this is the issue? WARNING: [IntuneManager] Unable to get product code from /var/folders/db/w7kxcbqx6mb6zltd2h_0hn1c0000gn/T/wintuner/Google.Chrome/126.0.6478.57/googlechromestandaloneenterprise64.msi because Microsoft.Deployment.WindowsInstaller.dll is not available on Linux

I'm using a mac.

svrooij commented 5 months ago

Thanks!

No the packaging is fine, just thinking that it does not load the info from the folder. Will add some more logging in the next version, to further debug what is happening.

The 'issue' that it's it not loading the details is expected. That prevents it from crashing.

svrooij commented 5 months ago

@holnburger can you have another try with version 0.8.9 and the debug switches, while it did not mention this is the release notes I added some logging to the deploy part to diagnose this problem.

holnburger commented 5 months ago

Thank you for implementing things that fast @svrooij! This is the output.

PS /Users/josef/Intune> New-WtWingetPackage -PackageId "Google.Chrome" -PackageFolder "/Users/josef/Intune" | Deploy-WtWin32App -Username "redacted@redacted.com" -Debug -Verbose
INFO: [WingetRepository] Loading package index from https://raw.githubusercontent.com/svrooij/winget-pkgs-index/main/index.json
INFO: [WingetRepository] Saving package index to cache at /Users/josef/Library/Application Support/WingetCommunityRepo/index.json
INFO: Packaging package Google.Chrome 126.0.6478.57
INFO: [WingetManager] Getting package info for Google.Chrome 126.0.6478.57 from github
INFO: [IntuneManager] Generating IntuneWin package for Google.Chrome 126.0.6478.57 X64 System in /Users/josef/Intune
INFO: [IntuneManager] Downloading installer from https://dl.google.com/dl/chrome/install/googlechromestandaloneenterprise64.msi to /var/folders/db/w7kxcbqx6mb6zltd2h_0hn1c0000gn/T/wintuner/Google.Chrome/126.0.6478.57/googlechromestandaloneenterprise64.msi
WARNING: [IntuneManager] Unable to get product code from /var/folders/db/w7kxcbqx6mb6zltd2h_0hn1c0000gn/T/wintuner/Google.Chrome/126.0.6478.57/googlechromestandaloneenterprise64.msi because Microsoft.Deployment.WindowsInstaller.dll is not available on Linux
INFO: [Packager] Creating Intune package from /var/folders/db/w7kxcbqx6mb6zltd2h_0hn1c0000gn/T/wintuner/Google.Chrome/126.0.6478.57
INFO: [Packager] Creating package for /var/folders/db/w7kxcbqx6mb6zltd2h_0hn1c0000gn/T/wintuner/Google.Chrome/126.0.6478.57/googlechromestandaloneenterprise64.msi in /var/folders/db/w7kxcbqx6mb6zltd2h_0hn1c0000gn/T/wintuner/Google.Chrome/126.0.6478.57 to /Users/josef/Intune/Google.Chrome/126.0.6478.57
INFO: [Packager] Compressing the source folder /var/folders/db/w7kxcbqx6mb6zltd2h_0hn1c0000gn/T/wintuner/Google.Chrome/126.0.6478.57 to /var/folders/db/w7kxcbqx6mb6zltd2h_0hn1c0000gn/T/16886554-3c3e-40b4-86c2-6d45be3ec016/IntuneWinPackage/Contents/IntunePackage.intunewin
INFO: [Packager] Generating application info
INFO: [Packager] Encrypting file /var/folders/db/w7kxcbqx6mb6zltd2h_0hn1c0000gn/T/16886554-3c3e-40b4-86c2-6d45be3ec016/IntuneWinPackage/Contents/IntunePackage.intunewin
INFO: [Packager] Generated detection XML file /var/folders/db/w7kxcbqx6mb6zltd2h_0hn1c0000gn/T/16886554-3c3e-40b4-86c2-6d45be3ec016/IntuneWinPackage/Metadata/Detection.xml
INFO: [Packager] Done creating package for /var/folders/db/w7kxcbqx6mb6zltd2h_0hn1c0000gn/T/wintuner/Google.Chrome/126.0.6478.57/googlechromestandaloneenterprise64.msi in /var/folders/db/w7kxcbqx6mb6zltd2h_0hn1c0000gn/T/wintuner/Google.Chrome/126.0.6478.57 to /Users/josef/Intune/Google.Chrome/126.0.6478.57
INFO: [IntuneManager] Downloading logo from https://api.winstall.app/icons/Google.Chrome.png
INFO: [DefaultFileManager] Skipping download of https://api.winstall.app/icons/Google.Chrome.png to /Users/josef/Intune/Google.Chrome/logo.png because the file already exists
INFO: [IntuneManager] Writing detection info with msi details Google.Chrome {829B647D-A3F1-39D5-B446-9D7EC9AB5705}
INFO: [IntuneManager] Writing package readme for package Google.Chrome
INFO: Loading package details from folder /Users/josef/Intune/Google.Chrome/126.0.6478.57
Deploy-WtWin32App: Value cannot be null. (Parameter 's')
PS /Users/josef/Intune> Get-InstalledModule -Name WinTuner

Version              Name                                Repository           Description
-------              ----                                ----------           -----------
0.8.9                WinTuner                            PSGallery            Package and publish any apps from WinGet to Intune.

The only difference in the logging seems to be:

INFO: [WingetRepository] Loading package index from https://raw.githubusercontent.com/svrooij/winget-pkgs-index/main/index.json
INFO: [WingetRepository] Saving package index to cache at /Users/josef/Library/Application Support/WingetCommunityRepo/index.json
svrooij commented 5 months ago

This happens every 3 hours:

INFO: [WingetRepository] Loading package index from https://raw.githubusercontent.com/svrooij/winget-pkgs-index/main/index.json
INFO: [WingetRepository] Saving package index to cache at /Users/josef/Library/Application Support/WingetCommunityRepo/index.json

You probably had it loaded already.

The problem is that there is something null, that shouldn't be, but the exception doesn't show which parameter.

This line:

INFO: Loading package details from folder /Users/josef/Intune/Google.Chrome/126.0.6478.57

comes from this code on the next line there is an exclamation sign ! which checks if the metadataManager is null (which it isn't suppose to).

If I check locally with a new fake program, it would tell me what object is null: image

Conclusion

This issue is hidden somewhere else, not sure how to find this without a mac available

holnburger commented 5 months ago

Happy to help with a live session if you have time for that. Completely understand if you don’t. Sadly can’t send you a Mac tough ;)

martin-mueller-cemas commented 3 months ago

Hi, I have the same issue with another package with WinTuner 0.9.1 running on PowerShell 7.4.5 (installed via Homebrew) on macOS 14.6.1.

Commands I ran:

Import-Module WinTuner
New-WtWingetPackage -PackageId "KeePassXCTeam.KeePassXC" -PackageFolder "/Users/martin/tmp/"
Deploy-WtWin32App -PackageId KeePassXCTeam.KeePassXC -Version 2.7.9 -RootPackageFolder "/Users/martin/tmp" -UseManagedIdentity $true

Other variants fail with the same error (Deploy-WtWin32App: Value cannot be null. (Parameter 's')):

Deploy-WtWin32App -PackageFolder "/Users/martin/tmp/KeePassXCTeam.KeePassXC/2.7.9" -UseManagedIdentity $true

Is there anything I can help (e.g. providing more logs or changing the source code for debugging output)?

svrooij commented 2 months ago

I stumbled upon the same issue when running this on Linux.... image

I think I can research it on Linux as well, still puzzled by this issue