From 0ed1eadf49f2defc11948e8deb856a5a594db9ff Mon Sep 17 00:00:00 2001 From: Szumovski Markus Date: Fri, 27 Mar 2020 12:17:31 +0100 Subject: [PATCH] The scope of all PowerShell-Core scripts/modules was always changed from AllUsers to CurrentUsers. This is not the expected behaviour of course. if I installed a PowerShell-Core script for all users I'd expect it to still be installed for all users after calling Update-Script, which wasn't the case currently. So the check for $script:IsCoreCLR was removed from the scope, since this ment for PowerShell-Core scripts/modules that they'd always be reinstalled into the user scope during updates, no matter the original scope of the PowerShell Core script/module. Also bumped version number so it can be deployed. --- src/PowerShellGet/PowerShellGet.psd1 | 62 ++++++++++--------- .../functions/Get-InstallationScope.ps1 | 1 - 2 files changed, 34 insertions(+), 29 deletions(-) diff --git a/src/PowerShellGet/PowerShellGet.psd1 b/src/PowerShellGet/PowerShellGet.psd1 index 6ba9e14a..f86976e9 100644 --- a/src/PowerShellGet/PowerShellGet.psd1 +++ b/src/PowerShellGet/PowerShellGet.psd1 @@ -1,6 +1,6 @@ @{ RootModule = 'PSModule.psm1' - ModuleVersion = '2.2.3' + ModuleVersion = '2.2.4' GUID = '1d73a601-4a6c-43c5-ba3f-619b18bbb404' Author = 'Microsoft Corporation' CompanyName = 'Microsoft Corporation' @@ -8,33 +8,33 @@ Description = 'PowerShell module with commands for discovering, installing, updating and publishing the PowerShell artifacts like Modules, DSC Resources, Role Capabilities and Scripts.' PowerShellVersion = '3.0' FormatsToProcess = 'PSGet.Format.ps1xml' - FunctionsToExport = @( - 'Find-Command', - 'Find-DSCResource', - 'Find-Module', - 'Find-RoleCapability', - 'Find-Script', - 'Get-CredsFromCredentialProvider', - 'Get-InstalledModule', - 'Get-InstalledScript', - 'Get-PSRepository', - 'Install-Module', - 'Install-Script', - 'New-ScriptFileInfo', - 'Publish-Module', - 'Publish-Script', - 'Register-PSRepository', - 'Save-Module', - 'Save-Script', - 'Set-PSRepository', - 'Test-ScriptFileInfo', - 'Uninstall-Module', - 'Uninstall-Script', - 'Unregister-PSRepository', - 'Update-Module', - 'Update-ModuleManifest', - 'Update-Script', - 'Update-ScriptFileInfo') +FunctionsToExport = @( + 'Find-Command', + 'Find-DSCResource', + 'Find-Module', + 'Find-RoleCapability', + 'Find-Script', + 'Get-CredsFromCredentialProvider', + 'Get-InstalledModule', + 'Get-InstalledScript', + 'Get-PSRepository', + 'Install-Module', + 'Install-Script', + 'New-ScriptFileInfo', + 'Publish-Module', + 'Publish-Script', + 'Register-PSRepository', + 'Save-Module', + 'Save-Script', + 'Set-PSRepository', + 'Test-ScriptFileInfo', + 'Uninstall-Module', + 'Uninstall-Script', + 'Unregister-PSRepository', + 'Update-Module', + 'Update-ModuleManifest', + 'Update-Script', + 'Update-ScriptFileInfo') VariablesToExport = 'PSGetPath' AliasesToExport = @('inmo', 'fimo', 'upmo', 'pumo') @@ -55,6 +55,11 @@ ProjectUri = 'https://go.microsoft.com/fwlink/?LinkId=828955' LicenseUri = 'https://go.microsoft.com/fwlink/?LinkId=829061' ReleaseNotes = @' +### 2.2.4 +Bug Fix + +- Keep AllUsers scope for PowerShell Core script/modules as well (not just up to PS 5.1) when updating via Update-Script and Update-Module + ### 2.2.3 - Update `HelpInfoUri` to point to the latest content (#560) - Improve discovery of usable nuget.exe binary (Thanks bwright86!) (#558) @@ -279,3 +284,4 @@ https://github.com/PowerShell/PowerShellGet/blob/master/CHANGELOG.md HelpInfoURI = 'http://go.microsoft.com/fwlink/?linkid=855963' } + diff --git a/src/PowerShellGet/private/functions/Get-InstallationScope.ps1 b/src/PowerShellGet/private/functions/Get-InstallationScope.ps1 index 7be34995..cf9b9303 100644 --- a/src/PowerShellGet/private/functions/Get-InstallationScope.ps1 +++ b/src/PowerShellGet/private/functions/Get-InstallationScope.ps1 @@ -14,7 +14,6 @@ function Get-InstallationScope() ) if ( -not $PreviousInstallLocation.ToString().StartsWith($currentUserPath, [System.StringComparison]::OrdinalIgnoreCase) -and - -not $script:IsCoreCLR -and (Test-RunningAsElevated)) { $Scope = "AllUsers" }