-
Notifications
You must be signed in to change notification settings - Fork 146
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
Step towards experimental group of settings in ADMX Policies #789
Merged
+182
−95
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
a427a2f
Update WAU.adml
AndrewDemski-ad-gmail-com a1385c8
Update WAU.admx
AndrewDemski-ad-gmail-com 6da87fc
Update Winget-Upgrade.ps1
AndrewDemski-ad-gmail-com 24e225a
Update Winget-Upgrade.ps1
AndrewDemski-ad-gmail-com b4fae71
Update Invoke-LogRotation.ps1
AndrewDemski-ad-gmail-com 79b940b
Update Winget-Upgrade.ps1
AndrewDemski-ad-gmail-com 4d9d0a0
Update Winget-Upgrade.ps1
AndrewDemski-ad-gmail-com 4b3cec9
Update Get-WingetCmd.ps1
AndrewDemski-ad-gmail-com c6d73dd
Update Winget-Upgrade.ps1
AndrewDemski-ad-gmail-com de4054e
Update Get-WingetOutdatedApps.ps1
AndrewDemski-ad-gmail-com 3584e24
Update Get-WingetSystemApps.ps1
AndrewDemski-ad-gmail-com 050d176
Update Winget-Upgrade.ps1
AndrewDemski-ad-gmail-com File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,27 @@ | ||
#Function to get the winget command regarding execution context (User, System...) | ||
|
||
Function Get-WingetCmd { | ||
|
||
$WingetCmd = $null | ||
[OutputType([String])] | ||
$WingetCmd = [string]::Empty; | ||
|
||
#Get WinGet Path | ||
# default winget path (in system context) | ||
[string]$ps = "$env:ProgramFiles\WindowsApps\Microsoft.DesktopAppInstaller_*_8wekyb3d8bbwe\winget.exe"; | ||
|
||
#default winget path (in user context) | ||
[string]$pu = "$env:LocalAppData\Microsoft\WindowsApps\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\winget.exe"; | ||
|
||
try { | ||
#Get Admin Context Winget Location | ||
$WingetInfo = (Get-Item "$env:ProgramFiles\WindowsApps\Microsoft.DesktopAppInstaller_*_8wekyb3d8bbwe\winget.exe").VersionInfo | Sort-Object -Property FileVersionRaw | ||
$WingetInfo = (Get-Item -Path $ps).VersionInfo | Sort-Object -Property FileVersionRaw -Descending | Select-Object -First 1; | ||
#If multiple versions, pick most recent one | ||
$WingetCmd = $WingetInfo[-1].FileName | ||
$WingetCmd = $WingetInfo.FileName; | ||
} | ||
catch { | ||
#Get User context Winget Location | ||
if (Test-Path "$env:LocalAppData\Microsoft\WindowsApps\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\winget.exe") { | ||
$WingetCmd = "$env:LocalAppData\Microsoft\WindowsApps\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\winget.exe" | ||
if (Test-Path -Path $pu -PathType Leaf) { | ||
$WingetCmd = $pu; | ||
} | ||
} | ||
|
||
return $WingetCmd | ||
|
||
return $WingetCmd; | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When the user part is executed it doesn't enter the catch thereby making
$WingetCmd
empty......and
17:52:56 - Checking application updates on Winget Repository named '' ..
it looks like it doesn't use a Repo...There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...nope it doesn't use a repo at all; not finding the usually skipped ones:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AndrewDemski-ad-gmail-com @Romanitho
Maybe inserting
-ErrorAction Break
in the Admin context check is enough for the problem with executing the user part (works in my small test)?:There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only thing that comes to my mind is that these two commands behave differently whether 'Path' argument is used or not:
(Get-Item -Path $ps)
(Get-Item $ps)
..which would be weird, because that was the only change in that section.
But you are right @KnifMelti, The try block should be started above those two strings are defined and -EA should be specified