Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ParameterArgumentValidationError,New-Win32App.ps1 #1

Open
napitmgmt opened this issue Jan 10, 2024 · 2 comments
Open

ParameterArgumentValidationError,New-Win32App.ps1 #1

napitmgmt opened this issue Jan 10, 2024 · 2 comments

Comments

@napitmgmt
Copy link

napitmgmt commented Jan 10, 2024

Hello!
Not shure if this is a bug or config error, and first of all thank you for this fantastic tool! Can't wait to get it running.
And I know it works since i watched a live demo at the NIC Cloud Connect conference 2023. ty @NickolajA

I'm running the pipeline with the included apps in the "default" repo (7-Zip and Notepad++)
No custom apps added. This is from my initial setup/test.
Followed the setup guide to the letter apart from renaming the KeyVault variables and the DevOps Agent pool name. (I have also renamed them in the publish.yml file)
Pipeline is running on a VM in Azure with custom agent as recommended.
Pipeline runs fine all the way incl. archiving, exept at the last step of publish__apps.

New-Win32App script fails with: System.IO.IOException: The handle is invalid.

DevOps agent info:
Edition Windows 11 Pro
Version 23H2
Installed on ‎1/‎9/‎2024
OS build 22631.2861
Experience Windows Feature Experience Pack 1000.22681.1000.0

$PSVersionTable.PSVersion
Major Minor Build Revision
5 1 22621 2506

Get-InstalledModule
Version Name Repository
2.15.0 Az.Accounts PSGallery
6.14.0 Az.Resources PSGallery
6.1.0 Az.Storage PSGallery
2312.878 Evergreen PSGallery
1.4.3 IntuneWin32App PSGallery
4.37.0.0 MSAL.PS PSGallery
1.1.4 MSGraphRequest PSGallery

winget -v
v1.6.3482

Error:

Reading contents from: C:\ADOAgent\_work\1\a\AppsPublishList\AppsPublishList.json
[APPLICATION: 7-Zip] - Initializing
Using Source folder path: C:\ADOAgent\_work\1\Publish\7zip\Source
Using Output folder path: C:\ADOAgent\_work\1\Publish\7zip\Package
Using Scripts folder path: C:\ADOAgent\_work\1\Publish\7zip\Scripts
Using icon file path: C:\ADOAgent\_work\1\Publish\7zip\Icon.png
Creating .intunewin package file from source folder
INFO   Validating parameters
INFO   Validated parameters within 3 milliseconds
INFO   Removing temporary files
ERROR  System.IO.IOException: The handle is invalid.`

at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.Console.GetBufferInfo(Boolean throwOnNoConsole, Boolean& succeeded)
   at Microsoft.Management.Service.IntuneWinAppUtil.LogUtil.PrintProgress(AppContext context)
   at Microsoft.Management.Service.IntuneWinAppUtil.PackageUtil.CreatePackage(String folder, String setupFile, String outputFolder, String catalogFolder)
   at Microsoft.Management.Service.IntuneWinAppUtil.Program.Main(String[] args)
WARNING: Unable to detect expected 'Deploy-Application.exe.intunewin' file after IntuneWinAppUtil.exe invocation
Creating default requirement rule
Creating additional custom requirement rules
Creating detection rules
Constructing an icon object
Creating Win32 application


C:\ADOAgent\_work\1\s\Scripts\New-Win32App.ps1 : Cannot validate argument on parameter 'FilePath'. Cannot bind 
argument to parameter 'Path' because it is an empty string.
At C:\ADOAgent\_work\_temp\2bfa738f-fa6b-43df-b81c-ff0784ea28ec.ps1:4 char:1
+ . 'C:\ADOAgent\_work\1\s\Scripts\New-Win32App.ps1' -TenantID 37826109 ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [New-Win32App.ps1], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationError,New-Win32App.ps1
 
##[error]PowerShell exited with code '1'.
Finishing: New-Win32App
@napitmgmt
Copy link
Author

napitmgmt commented Jan 10, 2024

Found this on the developer community. Looks very similar:
https://developercommunity.visualstudio.com/t/failure-to-run-intunewinapputilexe-on-hosted-devop/1269111
And this, here on GitHub:
MSEndpointMgr/IntuneWin32App#121

@napitmgmt
Copy link
Author

napitmgmt commented Jan 10, 2024

Temporary solution as suggested by Soolkiki:
MSEndpointMgr/IntuneWin32App#121 (comment)

Just before:

$IntuneAppPackage` = New-IntuneWin32AppPackage -SourceFolder $SourceFolder -SetupFile $AppData.PackageInformation.SetupFile -OutputFolder $OutputFolder

Added this line only:

Invoke-WebRequest -URI "https://github.com/microsoft/Microsoft-Win32-Content-Prep-Tool/raw/1a00a2a786de646c5fc46d6e1b79988c636e764e/IntuneWinAppUtil.exe" -outfile "$env:TEMP\IntuneWinAppUtil.exe"

The Pipeline now works and the apps are published in Intune.

Any suggestsions for a permanet sulotion?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant