Skip to content

Commit 0c40b37

Browse files
authored
Merge branch 'main' into check-cert-expired
2 parents b2efa69 + efed457 commit 0c40b37

File tree

8 files changed

+15
-20
lines changed

8 files changed

+15
-20
lines changed

.github/workflows/devskim.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,6 @@ jobs:
2929
uses: microsoft/DevSkim-Action@v1
3030

3131
- name: Upload DevSkim scan results to GitHub Security tab
32-
uses: github/codeql-action/[email protected].7
32+
uses: github/codeql-action/[email protected].10
3333
with:
3434
sarif_file: devskim-results.sarif

.github/workflows/powershell.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,6 @@ jobs:
4949

5050
# Upload the SARIF file generated in the previous step
5151
- name: Upload SARIF results file
52-
uses: github/codeql-action/upload-sarif@149d184a5153ea45e6fbcef5588ac7b8c7af9835 # v3.29.5
52+
uses: github/codeql-action/upload-sarif@a2d9de63c2916881d0621fdb7e65abe32141606d # v3.29.5
5353
with:
5454
sarif_file: results.sarif

.github/workflows/scorecards.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,14 @@ jobs:
6363
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
6464
# format to the repository Actions tab.
6565
- name: "Upload artifact"
66-
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
66+
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
6767
with:
6868
name: SARIF file
6969
path: results.sarif
7070
retention-days: 5
7171

7272
# Upload the results to GitHub's code scanning dashboard.
7373
- name: "Upload to code-scanning"
74-
uses: github/codeql-action/upload-sarif@149d184a5153ea45e6fbcef5588ac7b8c7af9835 # v3.29.5
74+
uses: github/codeql-action/upload-sarif@a2d9de63c2916881d0621fdb7e65abe32141606d # v3.29.5
7575
with:
7676
sarif_file: results.sarif

src/modules/SdnDiag.Common.psm1

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -795,8 +795,7 @@ function Start-EtwTraceSession {
795795
)
796796

797797
try {
798-
$logmanCmd = "logman create trace $TraceName -ow -o $TraceFile -nb 16 16 -bs 1024 -mode Circular -f bincirc -max $MaxTraceSize -ets"
799-
$result = Invoke-Expression -Command $logmanCmd
798+
$result = & logman create trace $TraceName -ow -o $TraceFile -nb 16 16 -bs 1024 -mode Circular -f bincirc -max $MaxTraceSize -ets
800799

801800
# Session create failure error need to be reported to user to be aware, this means we have one trace session missing.
802801
# Provider add failure might be ignored and exposed via verbose trace/log file only to debug.
@@ -808,8 +807,7 @@ function Start-EtwTraceSession {
808807
}
809808

810809
foreach ($provider in $TraceProviders) {
811-
$logmanCmd = 'logman update trace $TraceName -p "$provider" 0xffffffffffffffff 0xff -ets'
812-
$result = Invoke-Expression -Command $logmanCmd
810+
$result = & logman Update trace $TraceName -p $provider 0xffffffffffffffff 0xff -ets
813811
"Added provider {0} with result {1}" -f $provider, "$result" | Trace-Output -Level:Verbose
814812
}
815813
}
@@ -958,8 +956,7 @@ function Stop-EtwTraceSession {
958956
)
959957

960958
try {
961-
$logmanCmd = "logman stop $TraceName -ets"
962-
$result = Invoke-Expression -Command $logmanCmd
959+
$result = & logman stop $TraceName -ets
963960
if ("$result".Contains("Error")) {
964961
"Stop session {0} failed with error {1}" -f $TraceName, "$result" | Trace-Output -Level:Warning
965962
}

src/modules/SdnDiag.Gateway.psm1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ function Disable-SdnRasGatewayTracing {
113113

114114
try {
115115
# since there has not been a time when this as returned an error, just invoking the expression and not doing any error handling
116-
Invoke-Expression -Command "netsh ras set tracing * disabled"
116+
& netsh ras set tracing * disabled
117117

118118
Start-Sleep -Seconds 5
119119
$files = Get-Item -Path "$($config.properties.commonPaths.rasGatewayTraces)\*" -Include '*.log','*.etl'
@@ -155,7 +155,7 @@ function Enable-SdnRasGatewayTracing {
155155
}
156156

157157
# enable ras tracing
158-
$expression = Invoke-Expression -Command "netsh ras set tracing * enabled"
158+
$expression = & netsh ras set tracing * enabled
159159
if($expression -ilike "*Unable to start ETW*"){
160160
$msg = $expression[1]
161161
throw New-Object -TypeName System.Exception($msg)

src/modules/SdnDiag.Server.psm1

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -351,8 +351,7 @@ function Get-OvsdbDatabase {
351351
throw New-Object System.NullReferenceException("No endpoint listening on port 6641. Ensure NCHostAgent service is running.")
352352
}
353353

354-
$cmdline = "ovsdb-client.exe dump tcp:127.0.0.1:6641 -f json {0}" -f $Table
355-
$databaseResults = Invoke-Expression $cmdline | ConvertFrom-Json
354+
$databaseResults = & ovsdb-client.exe dump tcp:127.0.0.1:6641 -f json $Table | ConvertFrom-Json
356355

357356
if($null -eq $databaseResults){
358357
$msg = "Unable to retrieve OVSDB results`n`t{0}" -f $_
@@ -480,7 +479,7 @@ function Get-ServerConfigState {
480479
$hnvDiag | ForEach-Object {
481480
try {
482481
$cmd = $_
483-
Invoke-Expression -Command $cmd | Export-ObjectToFile -FilePath $outDir -Name $cmd -FileType txt -Format List
482+
& $cmd | Export-ObjectToFile -FilePath $outDir -Name $cmd -FileType txt -Format List
484483
}
485484
catch {
486485
"Failed to execute {0}" -f $cmd | Trace-Output -Level:Error
@@ -3343,8 +3342,7 @@ function Test-SdnVfpPortTuple {
33433342
# DestinationIP: Destination IP address or direction of the traffic relative to the direction
33443343
# DestinationPort: Destination port or direction of the traffic relative to the direction
33453344
# flags: 1 = TCP SYN, 2 = Monitoring Ping
3346-
$cmd = "vfpctrl /port $PortName /process-tuples '$protocolId $SourceIP $SourcePort $DestinationIP $DestinationPort $Direction 1'"
3347-
Invoke-Expression $cmd
3345+
& vfpctrl /port $PortName /process-tuples "$protocolID $SourceIP $SourcePort $DestinationIP $DestinationPort $Direction 1"
33483346
}
33493347
catch {
33503348
$_ | Trace-Exception

src/modules/SdnDiag.Utilities.psm1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1897,7 +1897,7 @@ function New-PSRemotingSession {
18971897
$trustedHosts = Get-Item -Path "WSMan:\localhost\client\TrustedHosts"
18981898
if ($trustedHosts.Value -notlike "*$objectName*" -and $trustedHosts.Value -ne "*") {
18991899
"Adding {0} to {1}" -f $objectName, $trustedHosts.PSPath | Trace-Output
1900-
Set-Item -Path "WSMan:\localhost\client\TrustedHosts" -Value $objectName -Concatenate
1900+
Set-Item -Path "WSMan:\localhost\client\TrustedHosts" -Value $objectName.ToString() -Concatenate -Force
19011901
}
19021902
}
19031903
catch {

tests/online/RunTests.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ param(
55
$Global:PesterOnlineTests = @{
66
}
77

8-
$Global:PesterOnlineTests.ConfigData = [hashtable] (Invoke-Expression (Get-Content -Path $ConfigurationFile | Out-String))
8+
$Global:PesterOnlineTests.ConfigData = [hashtable] (Get-Content -Path $ConfigurationFile | Out-String)
99

1010
$Global:PesterOnlineTests.NcRestCredential = [System.Management.Automation.PSCredential]::Empty
1111
#$ncAdminCredential = [System.Management.Automation.PSCredential]::Empty
@@ -37,4 +37,4 @@ if($testResult.Result -ne "Passed")
3737
}
3838

3939
# Exit code 0 indicate success
40-
return $testFailed
40+
return $testFailed

0 commit comments

Comments
 (0)