From 495fe6dbcd0893787f6735baaa775c4faaef1177 Mon Sep 17 00:00:00 2001 From: metablaster <44481081+metablaster@users.noreply.github.com> Date: Sun, 30 Jan 2022 21:40:36 +0100 Subject: [PATCH] test deployment --- .../Public/Test-Computer.ps1 | 1 + .../Public/Export-FirewallRule.ps1 | 2 +- .../Public/Export-RegistryRule.ps1 | 2 +- .../Public/Search-Installation.ps1 | 2 +- .../Public/Test-FileSystemPath.ps1 | 26 +++++++++---------- Readme/CHANGELOG.md | 1 + Rules/IPv4/Outbound/Software/Intel.ps1 | 2 +- 7 files changed, 18 insertions(+), 18 deletions(-) diff --git a/Modules/Ruleset.ComputerInfo/Public/Test-Computer.ps1 b/Modules/Ruleset.ComputerInfo/Public/Test-Computer.ps1 index 73dffd0a..0042837c 100644 --- a/Modules/Ruleset.ComputerInfo/Public/Test-Computer.ps1 +++ b/Modules/Ruleset.ComputerInfo/Public/Test-Computer.ps1 @@ -121,6 +121,7 @@ function Test-Computer Write-Debug -Message "[$($MyInvocation.InvocationName)] ParameterSet = $($PSCmdlet.ParameterSetName):$($PSBoundParameters | Out-String)" + # TODO: Run Deploy-Firewall (will will disconnect and remove CIM) and then this will fail if (Get-CimSession -Name RemoteCim) { $Status = $CimServer.TestConnection() diff --git a/Modules/Ruleset.Firewall/Public/Export-FirewallRule.ps1 b/Modules/Ruleset.Firewall/Public/Export-FirewallRule.ps1 index f0586b0b..7094d282 100644 --- a/Modules/Ruleset.Firewall/Public/Export-FirewallRule.ps1 +++ b/Modules/Ruleset.Firewall/Public/Export-FirewallRule.ps1 @@ -394,5 +394,5 @@ function Export-FirewallRule } } - Write-Information -Tags $MyInvocation.InvocationName -MessageData "INFO: Exporting firewall rules into: '$FileName' done" + Write-Information -Tags $MyInvocation.InvocationName -MessageData "INFO: Exporting firewall rules into '$FileName' done" } diff --git a/Modules/Ruleset.Firewall/Public/Export-RegistryRule.ps1 b/Modules/Ruleset.Firewall/Public/Export-RegistryRule.ps1 index b2d42459..42878595 100644 --- a/Modules/Ruleset.Firewall/Public/Export-RegistryRule.ps1 +++ b/Modules/Ruleset.Firewall/Public/Export-RegistryRule.ps1 @@ -321,5 +321,5 @@ function Export-RegistryRule } } - Write-Information -Tags $MyInvocation.InvocationName -MessageData "INFO: Exporting firewall rules into: '$FileName' done" + Write-Information -Tags $MyInvocation.InvocationName -MessageData "INFO: Exporting firewall rules into '$FileName' done" } diff --git a/Modules/Ruleset.ProgramInfo/Public/Search-Installation.ps1 b/Modules/Ruleset.ProgramInfo/Public/Search-Installation.ps1 index af62405c..59075da9 100644 --- a/Modules/Ruleset.ProgramInfo/Public/Search-Installation.ps1 +++ b/Modules/Ruleset.ProgramInfo/Public/Search-Installation.ps1 @@ -211,7 +211,7 @@ function Search-Installation } "XTU" { - Edit-Table "%ProgramFiles(x86)%\Intel\Intel(R) Extreme Tuning Utility\Client" + Edit-Table "%ProgramFiles%\Intel\Intel(R) Extreme Tuning Utility\Client" break } "Chocolatey" diff --git a/Modules/Ruleset.ProgramInfo/Public/Test-FileSystemPath.ps1 b/Modules/Ruleset.ProgramInfo/Public/Test-FileSystemPath.ps1 index 19906c74..df4d4a78 100644 --- a/Modules/Ruleset.ProgramInfo/Public/Test-FileSystemPath.ps1 +++ b/Modules/Ruleset.ProgramInfo/Public/Test-FileSystemPath.ps1 @@ -130,17 +130,15 @@ function Test-FileSystemPath ) Write-Debug -Message "[$($MyInvocation.InvocationName)] ParameterSet = $($PSCmdlet.ParameterSetName):$($PSBoundParameters | Out-String)" - function Write-Conditional - { - # TODO: Convert to script block - [Diagnostics.CodeAnalysis.SuppressMessageAttribute( - "PSProvideCommentHelp", "", Scope = "Function", Justification = "Self explanatory function")] + + $InvocationInfo = $MyInvocation.InvocationName + $WriteConditional = { param ([string] $Message) if ($Quiet) { # Make sure -Quiet switch does not make troubleshooting hard - Write-Debug -Message "[$($MyInvocation.InvocationName)] $Message" + Write-Debug -Message "[$InvocationInfo] $Message" } else { @@ -150,7 +148,7 @@ function Test-FileSystemPath } else { - Write-Warning -Message "[$($MyInvocation.InvocationName)] $Message" + Write-Warning -Message "[$InvocationInfo] $Message" } Write-Information -Tags $MyInvocation.InvocationName -MessageData "INFO: Path '$LiteralPath'" @@ -159,7 +157,7 @@ function Test-FileSystemPath if ([string]::IsNullOrEmpty($LiteralPath)) { - Write-Conditional "The path name is null or empty" + & $WriteConditional "The path name is null or empty" return $false } @@ -217,7 +215,7 @@ function Test-FileSystemPath { if ($IsUserProfile) { - Write-Conditional "A Path with environment variable which leads to user profile is not valid for firewall" + & $WriteConditional "A Path with environment variable which leads to user profile is not valid for firewall" return $false } @@ -230,7 +228,7 @@ function Test-FileSystemPath { if ($RegexVariable.Value -notin $WhiteList) { - Write-Conditional "Specified environment variable was not whitelisted for firewall" + & $WriteConditional "Specified environment variable was not whitelisted for firewall" return $false } @@ -241,13 +239,13 @@ function Test-FileSystemPath { if ($Qualifier -notmatch "^[A-Za-z]:\\") { - Write-Conditional "The path qualifier '$Qualifier' is not valid for firewall rules" + & $WriteConditional "The path qualifier '$Qualifier' is not valid for firewall rules" return $false } } else { - Write-Conditional "File system qualifier is required for firewall rules" + & $WriteConditional "File system qualifier is required for firewall rules" return $false } } @@ -255,7 +253,7 @@ function Test-FileSystemPath # NOTE: Public folder and it's subdirectories are not user profile if (!$IsUserProfile -and $UserProfile -and ($ExpandedPath -notmatch "^(($env:SystemDrive\\?)|\\)Users(?!\\+(Public$|Public\\+))\\")) { - Write-Conditional "The path does not lead to user profile" + & $WriteConditional "The path does not lead to user profile" return $false } } @@ -289,6 +287,6 @@ function Test-FileSystemPath } } - Write-Conditional $Status + & $WriteConditional $Status return $false } diff --git a/Readme/CHANGELOG.md b/Readme/CHANGELOG.md index c613b1c2..2273a155 100644 --- a/Readme/CHANGELOG.md +++ b/Readme/CHANGELOG.md @@ -41,6 +41,7 @@ If you would like to see fresh changes done since last release you can do so on - KMS Connection broker (SppExtComObj.exe) - MSI - Store apps + - Intel XTU - Rule scripts, consistent rule formatting for all scripts - Rule scripts now support Interactive and Quiet switches diff --git a/Rules/IPv4/Outbound/Software/Intel.ps1 b/Rules/IPv4/Outbound/Software/Intel.ps1 index 5cd1d5e6..7897e5b7 100644 --- a/Rules/IPv4/Outbound/Software/Intel.ps1 +++ b/Rules/IPv4/Outbound/Software/Intel.ps1 @@ -101,7 +101,7 @@ $PSDefaultParameterValues["Test-ExecutableFile:Force"] = $Trusted -or $SkipSigna # # Intel installation directories # -$IntelXTURoot = "%ProgramFiles(x86)%\Intel\Intel(R) Extreme Tuning Utility\Client" +$IntelXTURoot = "%ProgramFiles%\Intel\Intel(R) Extreme Tuning Utility\Client" # First remove all existing rules matching group Remove-NetFirewallRule -PolicyStore $PolicyStore -Group $Group -Direction $Direction -ErrorAction Ignore