Linter recommendations #2

This commit is contained in:
camoy 2024-12-28 19:53:58 -08:00
parent ae23c91374
commit 27a3bc5494
2 changed files with 3 additions and 3 deletions

View File

@ -1,6 +1,6 @@
Write-Host "---Create restore point for C:\---"
Checkpoint-Computer -Description "Before Sweetcade Install" -RestorePointType APPLICATION_INSTALL
if ( $? -ne True )
if ( $? -ne $true )
{
Write-Host "SC-RPT-ERR001: CANNOT CREATE RESTORE POINT"
Write-Host "Creating a restore point has failed. The reason for failure should be printed above."

View File

@ -1,8 +1,8 @@
Function fDefaultGatewayCheck() {
Write-Host "---Determine Default Gateway---"
#This doesn't put out a $null value when no data is returned!!! (i.e. no network connection, all network interfaces disabled)
Get-WmiObject -Class Win32_IP4RouteTable | where { $_.destination -eq '0.0.0.0' -and $_.mask -eq '0.0.0.0' } | Sort-Object nexthop, metric1, interfaceindex
$vSCNextHop = (Get-WmiObject -Class Win32_IP4RouteTable | where { $_.destination -eq '0.0.0.0' -and $_.mask -eq '0.0.0.0' } | Sort-Object metric1 | select nexthop | Format-Wide | Out-String).trim()
Get-WmiObject -Class Win32_IP4RouteTable | Where-Object { $_.destination -eq '0.0.0.0' -and $_.mask -eq '0.0.0.0' } | Sort-Object nexthop, metric1, interfaceindex
$vSCNextHop = (Get-WmiObject -Class Win32_IP4RouteTable | Where-Object { $_.destination -eq '0.0.0.0' -and $_.mask -eq '0.0.0.0' } | Sort-Object metric1 | Select-Object nexthop | Format-Wide | Out-String).trim()
#It's almost midnight and I have work tomorrow so I'm just looking for anything with numbers, maybe this could be better and look for a real IP address
#Also no idea if the network resources we call later have IPv6 support but it's 2024 lol
if ($vSCNextHop -contains "0123456789abcdef")