Skip to content

Commit

Permalink
update rules for google software
Browse files Browse the repository at this point in the history
  • Loading branch information
metablaster committed Nov 23, 2023
2 parents 0d7fd8f + 9b43bc9 commit 3ded878
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 5 deletions.
7 changes: 7 additions & 0 deletions Modules/Ruleset.Initialize/Public/Initialize-Project.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
24 changes: 23 additions & 1 deletion Modules/Ruleset.Initialize/Public/Initialize-Provider.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
Expand Down
7 changes: 5 additions & 2 deletions Modules/Ruleset.ProgramInfo/Public/Search-Installation.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion Scripts/Deploy-Firewall.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
6 changes: 5 additions & 1 deletion Scripts/Grant-Logs.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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)

Expand Down

0 comments on commit 3ded878

Please sign in to comment.