You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<#
Version: 1.0
Author:
- Joey Verlinden (joeyverlinden.com)
- Andrew Taylor (andrewstaylor.com)
- Florian Slazmann (scloud.work)
- Jannik Reinhard (jannikreinhard.com)
Script: winget-upgrade-remediate.ps1
Description: Updates all apps via Winget
Hint: This is a community script. There is no guarantee for this. Please check thoroughly before running.
Version 1.0: Init
Run as: System
Context: 64 Bit
#>
$Winget = Get-ChildItem -Path (Join-Path -Path (Join-Path -Path $env:ProgramFiles -ChildPath "WindowsApps") -ChildPath "Microsoft.DesktopAppInstaller*_x64*\AppInstallerCLI.exe")
&$winget upgrade --all --force --silent
However, it fails. I enabled script logging on a Windows 11 x64 Enterprise Edition and ran the script there. Output is below.
What could be the reason?
**********************
Windows PowerShell transcript start
Start time: 20230711185706
Username: WORKGROUP\SYSTEM
RunAs User: WORKGROUP\SYSTEM
Configuration Name:
Machine: DESKTOP-TU33KA5 (Microsoft Windows NT 10.0.22621.0)
Host Application: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -executionPolicy bypass -file C:\WINDOWS\IMECache\HealthScripts\aa5e509b-0345-44ee-b489-64231866412e_5\remediate.ps1
Process ID: 31824
PSVersion: 5.1.22621.1778
PSEdition: Desktop
PSCompatibleVersions: 1.0, 2.0, 3.0, 4.0, 5.0, 5.1.22621.1778
BuildVersion: 10.0.22621.1778
CLRVersion: 4.0.30319.42000
WSManStackVersion: 3.0
PSRemotingProtocolVersion: 2.3
SerializationVersion: 1.1.0.1
**********************
**********************
Command start time: 20230711185706
**********************
PS>CommandInvocation(remediate.ps1): "remediate.ps1"
**********************
Windows PowerShell transcript start
Start time: 20230711185706
Username: WORKGROUP\SYSTEM
RunAs User: WORKGROUP\SYSTEM
Configuration Name:
Machine: DESKTOP-TU33KA5 (Microsoft Windows NT 10.0.22621.0)
Host Application: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -executionPolicy bypass -file C:\WINDOWS\IMECache\HealthScripts\aa5e509b-0345-44ee-b489-64231866412e_5\remediate.ps1
Process ID: 31824
PSVersion: 5.1.22621.1778
PSEdition: Desktop
PSCompatibleVersions: 1.0, 2.0, 3.0, 4.0, 5.0, 5.1.22621.1778
BuildVersion: 10.0.22621.1778
CLRVersion: 4.0.30319.42000
WSManStackVersion: 3.0
PSRemotingProtocolVersion: 2.3
SerializationVersion: 1.1.0.1
**********************
**********************
Command start time: 20230711185707
**********************
PS>CommandInvocation(Out-String): "Out-String"
>> ParameterBinding(Out-String): name="InputObject"; value="The expression after '&' in a pipeline element produced an object that was not valid. It must result in a command name, a script block, or a CommandInfo object."
The expression after '&' in a pipeline element produced an object that was not valid. It must result in a command name,
a script block, or a CommandInfo object.
At C:\WINDOWS\IMECache\HealthScripts\aa5e509b-0345-44ee-b489-64231866412e_5\remediate.ps1:18 char:2
+ &$winget upgrade --all --force --silent
+ ~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : BadExpression
The expression after '&' in a pipeline element produced an object that was not valid. It must result in a command name,
a script block, or a CommandInfo object.
At C:\WINDOWS\IMECache\HealthScripts\aa5e509b-0345-44ee-b489-64231866412e_5\remediate.ps1:18 char:2
+ &$winget upgrade --all --force --silent
+ ~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : BadExpression
The expression after '&' in a pipeline element produced an object that was not valid. It must result in a command
name, a script block, or a CommandInfo object.
At C:\WINDOWS\IMECache\HealthScripts\aa5e509b-0345-44ee-b489-64231866412e_5\remediate.ps1:18 char:2
+ &$winget upgrade --all --force --silent
+ ~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : BadExpression
**********************
Command start time: 20230711185707
**********************
PS>$global:?
True
**********************
Windows PowerShell transcript end
End time: 20230711185707
**********************
The text was updated successfully, but these errors were encountered:
I do have Winget installed in System mode mode but when I try to run the remediation script, I also get this error:
The expression after '&' in a pipeline element produced an object that was not valid. It must result
in a command name, a script block, or a CommandInfo object.
At C:\Users\mduwady\Cision\IntuneTest - Documents\Scripts\Remediations\winget-upgrade-remediate.ps1:18
char:3
Running the Winget Update remediation script.
However, it fails. I enabled script logging on a Windows 11 x64 Enterprise Edition and ran the script there. Output is below.
What could be the reason?
The text was updated successfully, but these errors were encountered: