For some of my tests in Azure pipelines, I need winget to install them.
I tried different approaches. For example by using this script, with this result:
##[error]Test-IsAdmin : The term 'Test-IsAdmin' is not recognized as the name of a cmdlet, function, script file, or operable
program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At D:a1sinstallwinget.ps1:2 char:11
+ if (-not (Test-IsAdmin)) {
+ ~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Test-IsAdmin:String) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : CommandNotFoundException
##[error]PowerShell exited with code '1'.
and with this code
Invoke-WebRequest -Uri https://aka.ms/getwinget -OutFile winget.appinstaller.exe; Start-Process winget.appinstaller.exe
Having this result
##[error]Start-Process : This command cannot be run due to the error: The specified executable is not a valid application for
this OS platform..
At D:a1ssqlserverinstall.ps1:23 char:83
+ ... utFile winget.appinstaller.exe; Start-Process winget.appinstaller.exe
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Start-Process], InvalidOperationException
+ FullyQualifiedErrorId : InvalidOperationException,Microsoft.PowerShell.Commands.StartProcessCommand
Please help me out. I need something that works out the box and directly on azure pipelines (windows-2022
)
I tried several other approaches. They all fail.
Please help me out and provide something for me that works out of the box, directly and without any errors.