diff --git a/Modules/Ruleset.Initialize/Public/Initialize-Project.ps1 b/Modules/Ruleset.Initialize/Public/Initialize-Project.ps1 index 327512f5..c89d8e9c 100644 --- a/Modules/Ruleset.Initialize/Public/Initialize-Project.ps1 +++ b/Modules/Ruleset.Initialize/Public/Initialize-Project.ps1 @@ -314,6 +314,13 @@ function Initialize-Project if (!(Initialize-Provider -Required -ProviderName "NuGet" -RequiredVersion $RequireNuGetVersion ` -InfoMessage "Before updating PowerShellGet or PackageManagement, you should always install the latest Nuget provider")) { + if ($script:Restart) + { + Write-Warning -Message "[$($MyInvocation.InvocationName)] Please restart PowerShell for changes to take effect and run last command again" + Read-Host "Press enter to exit" + exit + } + return } diff --git a/Modules/Ruleset.Initialize/Public/Initialize-Provider.ps1 b/Modules/Ruleset.Initialize/Public/Initialize-Provider.ps1 index 6264d66b..31f43e34 100644 --- a/Modules/Ruleset.Initialize/Public/Initialize-Provider.ps1 +++ b/Modules/Ruleset.Initialize/Public/Initialize-Provider.ps1 @@ -439,7 +439,29 @@ function Initialize-Provider if ($Decision -eq $Default) { - Set-PackageSource -Name $FoundPackageSource.ProviderName -Trusted | Out-Null + try + { + # HACK: Set-PackageSource : Unable to find package source 'NuGet'. Use Get-PackageSource to see all available package sources + # This errored in Windows PowerShell on Windows 11 23H2 after automatic bootstraping of NuGet, + # a workaround is to restart PS and try again which is handled in Initialize-Project + # TODO: It won't be set to Trusted in that case which needs to be fixed, + # perhaps a new function to set Trusted flag on package source for modularity reasons + # See also beggining of this script, if it's found there it could be it's not trusted + Set-PackageSource -Name $FoundPackageSource.ProviderName -Trusted | Out-Null + } + catch + { + if ($ProviderName -eq "NuGet") + { + # PowerShell needs to restart + Set-Variable -Name Restart -Scope Script -Value $true + return $false + } + + Write-Error -ErrorRecord $_ + return $false + } + Write-Debug -Message "[$($MyInvocation.InvocationName)] Package provider '$($FoundPackageSource.ProviderName)' set to trusted" } } diff --git a/Modules/Ruleset.ProgramInfo/Public/Search-Installation.ps1 b/Modules/Ruleset.ProgramInfo/Public/Search-Installation.ps1 index 80505fd3..b92f16bc 100644 --- a/Modules/Ruleset.ProgramInfo/Public/Search-Installation.ps1 +++ b/Modules/Ruleset.ProgramInfo/Public/Search-Installation.ps1 @@ -709,14 +709,17 @@ function Search-Installation } "UnrealEngine" { - # NOTE: game engine does not have installer, it is managed by launcher, and if it's + # NOTE: Game engine does not have an installer, it is managed by launcher, and if it's # built from source user must enter path to engine manually $ExpandedPath = Invoke-Command @SessionParams -ArgumentList "%ProgramFiles%\Epic Games" -ScriptBlock { param ($Path) [System.Environment]::ExpandEnvironmentVariables($Path) } - if (Invoke-Command @SessionParams -ArgumentList $ExpandedPath -ScriptBlock { Test-Path $ExpandedPath }) + if (Invoke-Command @SessionParams -ArgumentList $ExpandedPath -ScriptBlock { + param ($ExpandedPath) + Test-Path $ExpandedPath } + ) { $VersionFolders = Invoke-Command @SessionParams -ArgumentList $ExpandedPath -ScriptBlock { param ($ExpandedPath) diff --git a/Scripts/Deploy-Firewall.ps1 b/Scripts/Deploy-Firewall.ps1 index 58b364c4..fd86916f 100644 --- a/Scripts/Deploy-Firewall.ps1 +++ b/Scripts/Deploy-Firewall.ps1 @@ -164,7 +164,8 @@ if ($PSBoundParameters.ContainsKey("Confirm")) # Prompt to set screen buffer to recommended value # TODO: It will ask again in same session, seems like set size is not set or Set-ScreenBuffer doesn't work -Set-ScreenBuffer 3000 @SetScreenBufferParams +# HACK: No longer works and exits console +# Set-ScreenBuffer 3000 @SetScreenBufferParams # Check all rules which apply to windows services and test digital signature of involved services Write-ServiceList $ProjectRoot\Rules -Log | ForEach-Object { diff --git a/Scripts/Grant-Logs.ps1 b/Scripts/Grant-Logs.ps1 index af774e82..bdfb5cb0 100644 --- a/Scripts/Grant-Logs.ps1 +++ b/Scripts/Grant-Logs.ps1 @@ -178,7 +178,11 @@ catch # If there is at least one change in logs location reboot is required foreach ($Location in $PreviousLocation) { - if (!(Compare-Path -Path $Location -ReferencePath $DestinationFolder)) + # NOTE: On a non configured GPO firewall log locations are empty strings, + # so Compare-Path -Path $Location will fail, reboot is required because the actual location + # is set in control panel firewall to default location + if ([string]::IsNullOrEmpty($Location) -or + !(Compare-Path -Path $Location -ReferencePath $DestinationFolder)) { Write-Warning -Message "[$ThisScript] System reboot is required for firewall logging path changes" return diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 3bffb82a..20cb73c7 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -50,6 +50,7 @@ Here is a list of changes for each of the releases. - `Uninstall-DuplicateModule` Improved to show reason for failure and how to fix - `Initialize-Provider` Was failing in Windows PS on Windows 11, fixed - `Invoke-Process` Fixed Write-* streams to show caller name + - `Search-Installation` Fixed a bug while searching for Epic games installation - Scripts @@ -62,6 +63,7 @@ Here is a list of changes for each of the releases. - Updated `Set-ATP.ps1` to adjust CPU throttling type to affect custom scans in addition to scheduled - Updated `Set-ATP.ps1` to optionally exclude or include optional and default settings - Updated `Set-Privacy.ps1` to not configure settings not available in Windows 11 + - Fixed an issue in `Grant-Logs` which failed if log location was not configured in GPO ## v0.15.0 (current release)