-
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
Conversation
Updated ADML for new experimental group and one experimental setting.
Updated ADMX for new experimental group and one experimental setting.
@KnifMelti Thanks in advance. |
Looks like it's working, I'm no expert. |
Added $Script:WingetSourceCustom (with fallback to 'winget')
Type aware refactor
fixed void return from function
#region Log running context #region Run Scope Machine function if run as System
last commit to that file today
removed duplicates
I lied.. now it is complete
Get-WingetOutdatedApps expects winget repo name and wont continue without it.
Very well.
BR |
What about setting 'Winget' as the default source, which could be changed via settings or GPO as suggested here? Second question: what happens when an experimental feature (and the corresponding GPO settings) is approved and moves to the root? |
Q1
A1It is already set in that PR. #region Winget Source Custom
# Default name of winget repository used within this script
[string]$DefaultWingetRepoName = 'winget';
# Defining custom repository for winget tool (only if GPO management is active)
if($Script:WAUConfig.WAU_ActivateGPOManagement) {
if($null -eq $Script:WAUConfig.WAU_WingetSourceCustom) {
[string]$Script:WingetSourceCustom = $DefaultWingetRepoName;
}
else {
[string]$Script:WingetSourceCustom = $Script:WAUConfig.WAU_WingetSourceCustom.Trim();
}
Write-ToLog "Selecting winget repository named '$($Script:WingetSourceCustom)'";
}
#endregion Winget Source Custom it calls #Get outdated Winget packages
Write-ToLog "Checking application updates on Winget Repository named '$($Script:WingetSourceCustom)' .." "yellow"
$outdated = Get-WingetOutdatedApps -src $Script:WingetSourceCustom; That function checks if repo name is not empty #Function to get the outdated app list, in formatted array
function Get-WingetOutdatedApps {
Param(
[Parameter(Position=0,Mandatory=$True,HelpMessage="You MUST supply value for winget repo, we need it")]
[ValidateNotNullorEmpty()]
[string]$src
)
# etc etc
#Get list of available upgrades on winget format
$upgradeResult = & $Winget upgrade --source $src | Where-Object { $_ -notlike " *" } | Out-String
# etc etc Q2
A2If by root you mean master branch, which will trigger all actions and new release will be deployed to world to be consumed by 6M unsuspecting souls? Your question proves one point, we need those experimental settings. There is no way we will come up with a new mechanism which will be able to distinguish execution context and b able to recognize non-PROD environments. Experimental features are easy to control and can be easily promoted to become a part of main product. If everything is tested enough, then it is just a matter of readdressing a particular GPO option to show outside of experimental node. |
I forgot about the second function missing commit 1of2
I forgot about the second function missing commit 2of2
Last two commits (3584e24 and 050d176) prove that I am prone to writing incomplete code, i missed the winget word when it was used as constant. .. i think P.S. I hope that there will be no need to fix anything else. |
Regarding my Q1, I was thinking of setting the |
We are hitting two birds with one stone now:
IMHO it is worth it. |
It's time to merge this part, I guess. A lot of rework has been done, and probably another task is coming: cleaning the whole code. ^^ |
#If multiple versions, pick most recent one | ||
$WingetCmd = $WingetInfo[-1].FileName | ||
$WingetCmd = $WingetInfo.FileName; | ||
} | ||
catch { |
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.
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:
16:51:49 - Epic Games Launcher : Skipped upgrade because it is in the excluded app list
16:51:49 - Windows Assessment and Deployment Kit - Windows 10 : Skipped upgrade because it is in the excluded app list
16:51:49 - Ubisoft Connect : Skipped upgrade because it is in the excluded app list
16:51:49 - Mozilla Firefox (x64 en-GB) : Skipped upgrade because it is *wildcard* in the excluded app list
16:51:49 - MSTeams : Skipped upgrade because it is *wildcard* in the excluded app list
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)?:
#Get Admin Context Winget Location
$WingetInfo = (Get-Item -Path $ps -ErrorAction Break).VersionInfo | Sort-Object -Property FileVersionRaw -Descending | Select-Object -First 1;
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
Missing failsafe when winget does not exist in system context (trigger for fallback to instance in the user context). Addendum to logic changed in PR Romanitho#789
There.. #817 |
Hoiw about the missing repo causing it to not find anything? |
|
Proposed Changes
Related Issues
BR
AD