merged util scripts into this repo

This commit is contained in:
Brian Warren 2025-04-12 18:15:32 -05:00
parent fc5670f770
commit 5e37a46e67
16 changed files with 1150 additions and 18 deletions

16
.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,16 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "PowerShell: Launch Current File",
"type": "PowerShell",
"request": "launch",
"script": "${file}",
"args": ["-airline UA -action export -comServerType CHECKIN -registryHive HKLM -enableDebugging -comServerDir C:\\temp\\UA\\UA-SUITE\\39.11\\UASRDEV\\cupps\\6.0.3 -comServerFileName uasrdevq.exe"]
}
]
}

View File

@ -0,0 +1,396 @@
#
# ConnectivityCheck.ps1
#
param (
[parameter(Mandatory=$true)]
[string]
$NameResolutionFileName,
[parameter(Mandatory=$true)]
[string]
$TcpEndpointsFileName,
[parameter(Mandatory=$false)]
[string]
$OutDir = $Env:Temp,
[parameter(Mandatory=$false)]
[string]
$CheckHostsFile
)
$BlnCheckHostsFile = $false
if ($CheckHostsFile) {
if ($CheckHostsFile -ine "false" -and $CheckHostFile -ine "no" -and $CheckHostFile -ne "0") {
$BlnCheckHostsFile = $true
}
}
# Functions
#
# Override the built-in cmdlet with a custom version
function Write-ErrorMsg($Message) {
[Console]::ForegroundColor = 'red'
Write-Output $Message
[Console]::ResetColor()
}
function Convert-ByteArrayToHex {
[cmdletbinding()]
param(
[parameter(Mandatory=$true)]
[Byte[]]
$Bytes
)
#$HexString = [System.Text.StringBuilder]::new($Bytes.Length * 2)
$HexString = New-Object System.Text.StringBuilder($Bytes.Length * 2)
ForEach($Byte in $Bytes){
$HexString.AppendFormat("{0:x2}", $Byte) | Out-Null
}
$HexString.ToString()
}
function Convert-HexToByteArray {
[cmdletbinding()]
param(
[parameter(Mandatory=$true)]
[String]
$HexString)
# $Bytes = [byte[]]::new($HexString.Length / 2)
$Bytes = New-Object byte[]($HexString.Length / 2)
For($i=0; $i -lt $HexString.Length; $i+=2){
$Bytes[$i/2] = [convert]::ToByte($HexString.Substring($i, 2), 16)
}
$Bytes
}
function IsPortOpen {
param(
[parameter(Mandatory=$true)]
[string]
$HostName,
[parameter(Mandatory=$true)]
[int]
$Port,
[parameter(Mandatory=$false)]
[int]
$Timeout = 5000)
$Result = $null
# REMOVED: TCPClient's ConnectAsync not available in older powershell
# $Client = New-Object System.Net.Sockets.TCPClient
# $Timeout =
# $IsOpen = $Client.ConnectAsync($HostName, $Port).Wait($Timeout)
$Client = New-Object System.Net.Sockets.TCPClient
$IsOpen = $false
try {
$AsyncResult = $Client.BeginConnect($HostName, $Port, $null, $null)
if (!$AsyncResult.AsyncWaitHandle.WaitOne($Timeout, $false))
{
throw [System.TimeoutException]::new();
}
$Client.EndConnect($AsyncResult) | Out-Null
$IsOpen = $Client.Connected
}
catch {
$IsOpen = $false
}
finally {
$Client.Close();
}
if ($IsOpen) {
$Result = "Success"
}
else {
$Result = "Fail"
}
"$($Result): $($HostName):$($Port)"
}
function Read-Hosts-File-To-Hash {
Param (
[string] $FileName,
[int] $IncludeCommentedLines)
$HostHash = @{}
if (-not (Test-Path -Path $FileName)) {
Write-ErrorMsg "Error: file not found: $($FileName)"
return $null
}
# $Lines = Get-Content -Path $FileName
$Lines = [IO.File]::ReadAllLines($FileName)
foreach ($Line in $Lines) {
$Line = $Line.Trim()
if ($Line.Length -lt 9) {
continue
}
$Chars = $Line.ToCharArray()
if ($Chars[0] -eq '#') {
if ($IncludeCommentedLines -eq 0) {
continue
}
}
$Line = $Line.Trim('#')
if ($Line.Length -lt 9) {
continue
}
$ix = $Line.IndexOf('#')
if ($ix -gt 0) {
if ($ix -lt 9) {
continue
}
$Line = $Line.Substring(0, $ix)
}
$Words = ($Line -split ' ')
if ($Words.Count -lt 2) {
continue
}
$Ip = $Words[0]
try {
[IPAddress]$Ip > $null
}
catch {
continue
}
$Names = New-Object System.Collections.Generic.List[String]
for ($i = 1; $i -lt $Words.Count; ++$i) {
$Word = $Words[$i].Trim()
if ($Word) {
$Names.Add($Words[$i])
}
}
if ($HostHash.ContainsKey($Ip)) {
foreach ($Name in $Names) {
$HostHash[$Ip].Add($Name)
}
}
else {
$HostHash.Add($Ip, $Names)
}
}
$HostHash
}
function Read-TcpEndpoints-File-To-Hash {
Param (
[string] $FileName,
[int] $IncludeCommentedLines)
$TcpEndpointsHash = @{}
if (-not (Test-Path -Path $FileName)) {
Write-ErrorMsg "Error: file not found: $($FileName)"
return $null
}
# $Lines = Get-Content -Path $FileName
$Lines = [IO.File]::ReadAllLines($FileName)
foreach ($Line in $Lines) {
$Line = $Line.Trim()
if ($Line.Length -lt 9) {
continue
}
$Chars = $Line.ToCharArray()
if ($Chars[0] -eq '#') {
if ($IncludeCommentedLines -eq 0) {
continue
}
}
$Line = $Line.Trim('#')
if ($Line.Length -lt 9) {
continue
}
$ix = $Line.IndexOf('#')
if ($ix -gt 0) {
if ($ix -lt 9) {
continue
}
$Line = $Line.Substring(0, $ix)
}
$Parts = ($Line -split ' ')
if ($Parts.Count -lt 2) {
continue
}
$Ip = $Parts[0]
try {
[IPAddress]$Ip > $null
}
catch {
continue
}
$PortsCsv = $Parts[1]
$PortsArr = ($PortsCsv -split ',')
$Ports = New-Object System.Collections.Generic.List[String]
for ($i = 0; $i -lt $PortsArr.Count; ++$i) {
$Port = $PortsArr[$i]
$Port = $Port.Trim()
if ($Port) {
$Ports.Add($Port)
}
}
if ($TcpEndpointsHash.ContainsKey($Ip)) {
foreach ($Port in $Ports) {
$TcpEndpointsHash[$Ip] = $Ports
}
}
else {
$TcpEndpointsHash.Add($Ip, $Ports)
}
}
$TcpEndpointsHash
}
# Set Up
#
$DateStringPrefix = Get-Date -Format "yyyy-MM-dd_HHmmss__"
if (-not (Test-Path -Path $OutDir)) {
New-Item -ItemType Directory -Force -Path $OutDir >$null
}
$OutFileName = Join-Path -Path $OutDir -ChildPath "$($DateStringPrefix)ConnectivityCheck.log"
$ErrorActionPreference="SilentlyContinue"
Stop-Transcript | out-null
$ErrorActionPreference = "Continue"
Start-Transcript -path $OutFileName
Write-Host
# Retrieve IPs and host names from file for name resolution check.
$HostsFileName = "$($Env:windir)\system32\drivers\etc\hosts"
if (Test-Path -Path $NameResolutionFileName) {
Write-Host "Retrieving IPs and host names from $NameResolutionFileName..."
$NameResolutionTable = Read-Hosts-File-To-Hash $NameResolutionFileName 0
} else {
Write-ErrorMsg "Name resolution file missing: $NameResolutionFileName"
$NameResolutionTable = $null
}
if (Test-Path -Path $HostsFileName) {
$NameResolutionTable = Read-Hosts-File-To-Hash $HostsFileName.ToString() 0
} else {
Write-ErrorMsg "System hosts file missing: $HostsFileName"
$NameResolutionTable = $null
}
# Retrieve TCP endpoints from file for connectivity check.
if (Test-Path -Path $TcpEndpointsFileName) {
Write-Host "Retrieving TCP endpoints from $TcpEndpointsFileName..."
$TcpEndpointMap = Read-TcpEndpoints-File-To-Hash $TcpEndpointsFileName
} else {
Write-ErrorMsg "TCP endpoints file missing: $TcpEndpointsFileName"
$TcpEndpointMap = $null
}
# Name Resolution Check
#
Write-Output "`r`n`r`nNAME RESOLUTION TEST ($NameResolutionFileName):`r`n"
if ($null -ne $NameResolutionTable) {
foreach ($IpCorrect in $NameResolutionTable.Keys) {
$Names = $NameResolutionTable[$IpCorrect]
foreach ($Name in $Names) {
if (!$Name) {
continue
}
$AddressList = $null
try {
$AddressList = [System.Net.Dns]::GetHostAddresses($Name)
}
catch {
Write-ErrorMsg "Error: $($Name) doesn't resolve."
continue
}
$IpList = New-Object 'System.Collections.Generic.List[string]'
foreach ($Ip in $AddressList) {
if ($Ip.AddressFamily -ne "InterNetwork") {
continue
}
if ($IpList.Contains($Ip.IPAddressToString)) {
continue
}
$IpList.Add($Ip.IPAddressToString) > $null
}
if ($IpList.Count -eq 0) {
Write-ErrorMsg "Error: $($Name) doesn't resolve to any IPv4 addresses."
continue
}
if ($IpList.Count -gt 1) {
Write-ErrorMsg "Error: $($Name) resolves to multiple IP addresses: $($IpList -join ', ')"
continue
}
$Ip = $IpList[0]
if ($IpCorrect -eq $Ip) {
#Write-Output "Success: $($Name) resolves to $($IpCorrect)"
Write-Output "Success: $($IpCorrect) resolved from $($Name)"
}
else {
Write-ErrorMsg "Error: $($Name) resolves to $($Ip) instead of $($IpCorrect)."
}
}
}
}
# Hosts file check
#
if ($BlnCheckHostsFile) {
Write-Output "`r`n`r`nHOSTS FILE CHECK ($($HostsFileName)):`r`n"
if ($null -ne $NameResolutionTable -and $null -ne $NameResolutionTable) {
foreach ($Ip in $NameResolutionTable.Keys) {
$SourceNames = $NameResolutionTable[$Ip]
$SourceNamesStr = $SourceNames -join " "
$SourceEntryStr = "$($Ip) $($SourceNamesStr)"
if (-not $NameResolutionTable.ContainsKey($Ip)) {
Write-ErrorMsg "Error: missing entry equivalent to '$($SourceEntryStr)'"
continue
}
$MissingNames = @()
$Names = $NameResolutionTable[$Ip]
foreach ($SourceName in $SourceNames) {
if (-not ($Names -contains $SourceName)) {
$MissingNames += $SourceName
}
}
if (0 -lt $MissingNames.count) {
Write-ErrorMsg "Error: entry or entries for $($Ip) missing the following names: $($MissingNames -join ' ')"
} else {
foreach ($SourceName in $SourceNames) {
Write-Output "Success: found $($Ip) $($SourceName)"
}
}
}
}
}
# TCP connectivity check
#
$EndPoints = New-Object System.Collections.Generic.List[Object]
Write-Output "`r`n`r`nTCP CONNECTIVITY TEST:`r`n"
if ($null -ne $TcpEndpointMap) {
foreach ($Ip in $TcpEndpointMap.Keys)
{
$Ports = $TcpEndpointMap[$Ip]
foreach ($Port in $Ports) {
$ThisEndPoint = New-Object PSObject -Property @{
Host = [string]$Ip
Port = [int]$Port
}
$EndPoints.Add($ThisEndPoint)
}
}
}
foreach ($EndPoint in $EndPoints) {
IsPortOpen -hostName $EndPoint.Host -port $EndPoint.Port
}
# Clean up
#
Stop-Transcript

View File

@ -0,0 +1,42 @@
@echo off
title Connectivity Check
setlocal
@REM Set default values
if [%1]==[/?] goto Usage
if [%1]==[] goto Usage
if [%2]==[] goto Usage
@REM Handle command line args
set "EndpointsFileName=%~1"
set "NameResolutionFileName=%~2"
set "OutDir=%~3"
set "CheckHostsFile=%~4"
set "PauseAfter=%~5"
@REM Map temporary drive to be able to handle UNC path
pushd %0\..
set "ROOT=%cd%"
@REM Run script
powershell -ExecutionPolicy Bypass "%ROOT%\ConnectivityCheck.ps1" "%EndpointsFileName%" "%NameResolutionFileName%" "%OutDir%" "%CheckHostsFile%"
@REM Unmap temporary drive used to handle UNC path
popd
goto Exit
:Usage
echo %~n0 endpoints_file name_resolution_file [out_dir] [check_hosts_file] [pause_after]
echo Examples:
echo %~n0 endpoints.txt name_resolution.txt C:\temp true
:Exit
@REM Pause if desired flag is set
if /i "%PauseAfter%" == "true" pause
endlocal

View File

@ -0,0 +1,196 @@
#
# Common.ps1
#
# Override the built-in cmdlet with a custom version
function Write-ErrorMsg($message) {
[Console]::ForegroundColor = 'red'
Write-Output $message
[Console]::ResetColor()
}
function Convert-ByteArrayToHex {
[cmdletbinding()]
param(
[parameter(Mandatory=$true)]
[Byte[]]
$bytes
)
#$hexString = [System.Text.StringBuilder]::new($bytes.Length * 2)
$hexString = New-Object System.Text.StringBuilder($bytes.Length * 2)
ForEach($byte in $bytes){
$hexString.AppendFormat("{0:x2}", $byte) | Out-Null
}
$hexString.ToString()
}
function Convert-HexToByteArray {
[cmdletbinding()]
param(
[parameter(Mandatory=$true)]
[String]
$hexString)
# $bytes = [byte[]]::new($hexString.Length / 2)
$bytes = New-Object byte[]($hexString.Length / 2)
For($i=0; $i -lt $hexString.Length; $i+=2){
$bytes[$i/2] = [convert]::ToByte($hexString.Substring($i, 2), 16)
}
$bytes
}
function Build-SharesMessage {
param(
[string] $lniata,
[string] $message)
$bytes = Convert-HexToByteArray($lniata);
#TODO: add message to LNIATA
$bytes
}
function IsPortOpen {
param(
[parameter(Mandatory=$true)]
[string]
$hostName,
[parameter(Mandatory=$true)]
[int]
$port,
[parameter(Mandatory=$false)]
[int]
$timeout = 5000)
$result = $null
# REMOVED: TCPClient's ConnectAsync not available in older powershell
# $client = New-Object System.Net.Sockets.TCPClient
# $timeout =
# $isOpen = $client.ConnectAsync($hostName, $port).Wait($timeout)
$client = New-Object System.Net.Sockets.TCPClient
$isOpen = $false
try {
$asyncResult = $client.BeginConnect($hostName, $port, $null, $null)
if (!$asyncResult.AsyncWaitHandle.WaitOne($timeout, $false))
{
throw [System.TimeoutException]::new();
}
$client.EndConnect($asyncResult) | Out-Null
$isOpen = $client.Connected
}
catch {
$isOpen = $false
}
finally {
$client.Close();
}
if ($isOpen) {
$result = "Success"
}
else {
$result = "Fail"
}
"$($result): $($hostName):$($port)"
}
function Send-UdpDatagram {
Param (
[string] $ip,
[int] $port)
$address = [System.Net.IPAddress]::Parse($ip)
$endPoints = New-Object System.Net.IPEndPoint($address, $port)
$socket = New-Object System.Net.Sockets.UDPClient
#$data = [Text.Encoding]::ASCII.GetBytes($message)
$data = Build-SharesMessage("ba0252fe");
#$sendMessage = $socket.Send($data, $data.Length, $endPoints)
$socket.Send($data, $data.Length, $endPoints) > $null
$Socket.Close()
}
function Read-Hosts-File-To-Hash {
Param (
[string] $fileName,
[switch] $includeCommentedLines)
$hostHash = @{}
if (-not (Test-Path -Path $fileName)) {
Write-ErrorMsg "Error: file not found: $($fileName)"
return $null
}
# $lines = Get-Content -Path $fileName
$lines = [IO.File]::ReadAllLines($fileName)
foreach ($line in $lines) {
$line = $line.Trim()
$isCommented = $false
if ($line.Length -lt 7) {
continue
}
$chars = $line.ToCharArray()
if ($chars[0] -eq '#') {
if (-not $includeCommentedLines) {
continue
}
$isCommented = $true
}
$line = $line.Trim('#')
if ($line.Length -lt 7) {
continue
}
$ix = $line.IndexOf('#')
if ($ix -gt 0) {
if ($ix -lt 7) {
continue
}
$line = $line.Substring(0, $ix)
}
$words = ($line -split ' ')
$ip = $words[0]
try {
[IPAddress]$ip > $null
}
catch {
continue
}
if ($isCommented) {
$hostHash.Add($ip, $null)
continue
}
if ($words.Count -eq 1) {
continue
}
$names = New-Object System.Collections.Generic.List[String]
for ($i = 1; $i -lt $words.Count; ++$i) {
$word = $words[$i].Trim()
if ($word) {
$names.Add($words[$i])
}
}
if ($hostHash.ContainsKey($ip)) {
foreach ($name in $names) {
$hostHash[$ip].Add($name)
}
}
else {
$hostHash.Add($ip, $names)
}
}
$hostHash
}
$workingDir = Get-Location
$uaHostsFileName = Join-Path -Path $workingDir -ChildPath 'ua_hosts.txt'
$hostsFileName = "$($Env:windir)\system32\drivers\etc\hosts"
if (Test-Path -Path $uaHostsFileName) {
$ipHashTable = Read-Hosts-File-To-Hash $uaHostsFileName $true
$uaHostHashTable = Read-Hosts-File-To-Hash $uaHostsFileName $false
} else {
Write-ErrorMsg "UA host entry file missing: $uaHostsFileName"
$ipHashTable = $null
$uaHostHashTable = $null
}
if (Test-Path -Path $hostsFileName) {
$hostHashTable = Read-Hosts-File-To-Hash $hostsFileName.ToString() $false
} else {
Write-ErrorMsg "System hosts file missing: $hostsFileName"
$hostHashTable = $null
}

View File

@ -0,0 +1,33 @@
#
# HostsFileCheck.ps1
#
. ".\Common.ps1"
Write-Output "`r`n`r`nHOSTS FILE CHECK ($($hostsFileName)):`r`n"
if ($null -ne $uaHostHashTable -and $null -ne $hostHashTable) {
foreach ($ip in $uaHostHashTable.Keys) {
$uaNames = $uaHostHashTable[$ip]
$uaNamesStr = $uaNames -join " "
$uaEntryStr = "$($ip) $($uaNamesStr)"
if (-not $hostHashTable.ContainsKey($ip)) {
Write-ErrorMsg "Error: missing entry equivalent to '$($uaEntryStr)'"
continue
}
$missingNames = @();
$names = $hostHashTable[$ip]
foreach ($uaName in $uaNames) {
if (-not ($names -contains $uaName)) {
$missingNames += $uaName
}
}
if (0 -lt $missingNames.count) {
Write-ErrorMsg "Error: entry or entries for $($ip) missing the following names: $($missingNames -join ' ')"
} else {
foreach ($uaName in $uaNames) {
Write-Output "Success: found $($ip) $($uaName)"
}
}
}
}

View File

@ -0,0 +1,51 @@
#
# NameResolutionCheck.ps1
#
. ".\Common.ps1"
Write-Output "`r`n`r`nNAME RESOLUTION TEST ($($uaHostsFileName)):`r`n"
if ($null -ne $uaHostHashTable) {
foreach ($ipCorrect in $uaHostHashTable.Keys) {
$names = $uaHostHashTable[$ipCorrect]
foreach ($name in $names) {
if (!$name) {
continue
}
$addressList = $null
try {
$addressList = [System.Net.Dns]::GetHostAddresses($name)
}
catch {
Write-ErrorMsg "Error: $($name) doesn't resolve."
continue
}
$ipList = New-Object 'System.Collections.Generic.List[string]'
foreach ($ip in $addressList) {
if ($ip.AddressFamily -ne "InterNetwork") {
continue
}
if ($ipList.Contains($ip.IPAddressToString)) {
continue
}
$ipList.Add($ip.IPAddressToString) > $null
}
if ($ipList.Count -eq 0) {
Write-ErrorMsg "Error: $($name) doesn't resolve to any IPv4 addresses."
continue
}
if ($ipList.Count -gt 1) {
Write-ErrorMsg "Error: $($name) resolves to multiple IP addresses: $($ipList -join ', ')"
continue
}
$ip = $ipList[0]
if ($ipCorrect -eq $ip) {
#Write-Output "Success: $($name) resolves to $($ipCorrect)"
Write-Output "Success: $($ipCorrect) resolved from $($name)"
}
else {
Write-ErrorMsg "Error: $($name) resolves to $($ip) instead of $($ipCorrect)."
}
}
}
}

View File

@ -0,0 +1,58 @@
#
# TcpCheck.ps1
#
. '.\Common.ps1'
$endPoints = New-Object System.Collections.Generic.List[Object]
Write-Output "`r`n`r`nTCP CONNECTIVITY TEST:`r`n"
$defaultPorts = @(80,443)
$nonDefaultPortMap = @{
'204.26.248.58' = @(53310, 53330) #Shares
'57.14.12.254' = @(102) #Unimatic
'10.232.100.72' = @(50002) #GateReader alternative
'57.228.112.12' = @(50002) #GateReader primary
'57.14.12.21' = @(443)
'57.14.12.24' = @(443)
'57.14.12.20' = @(443)
'57.14.13.142' = @(443)
'57.14.13.143' = @(443)
'57.14.13.144' = @(443)
'57.14.13.24' = @(443)
'57.14.12.122' = @(80)
};
if ($null -ne $ipHashTable) {
foreach ($ip in $ipHashTable.Keys)
{
$ports = @()
if ($nonDefaultPortMap.ContainsKey($ip)) {
$ports = $nonDefaultPortMap[$ip]
}
else {
$ports = $defaultPorts
}
foreach ($port in $ports) {
$thisEndPoint = New-Object PSObject -Property @{
Host = [string]$ip
Port = [int]$port
}
$endPoints.Add($thisEndPoint);
}
}
}
# REMOVED: -Parallel only works in newer powershell versions
# # Asynchronous port check
# $isPortOpenDef = $function:IsPortOpen.ToString()
# $endPoints | ForEach-Object -Parallel {
# $function:IsPortOpen = $using:isPortOpenDef
# IsPortOpen -hostName $_.Host -port $_.Port
# }
# Synchronous port check
foreach ($endPoint in $endPoints) {
IsPortOpen -hostName $endPoint.Host -port $endPoint.Port
}

View File

@ -0,0 +1,22 @@
#
# UAConnectivityCheck.ps1
#
$scriptLabel = "UAConnectivityCheck"
$dateStringPrefix = Get-Date -Format "yyyy-MM-dd_HHmm__"
$outDir = Join-Path -Path $env:Temp -ChildPath $scriptLabel
if (-not (Test-Path -Path $outDir)) {
New-Item -Path $env:Temp -Name $scriptLabel -ItemType "directory"
}
$outFileName = Join-Path -Path $outDir -ChildPath "$($dateStringPrefix)$($scriptLabel).log"
$ErrorActionPreference="SilentlyContinue"
Stop-Transcript | out-null
$ErrorActionPreference = "Continue"
Start-Transcript -path $outFileName
& ".\NameResolutionCheck.ps1"
& ".\HostsFileCheck.ps1"
& ".\TcpCheck.ps1"
& ".\UdpCheck.ps1"
Stop-Transcript

View File

@ -0,0 +1,78 @@
#
# UdpCheck.ps1
#
. ".\Common.ps1"
# Set up variables
$qloiws04LniataVdu = "ba0252"
$sharesIpUdp = "204.26.250.37"
$sharesUdpPorts = 3020, 3024
function CheckUdp {
param(
[parameter(Mandatory=$true)]
[int]
$port)
try
{
$ta = $qloiws04LniataVdu.substring(4,2);
$taInt = [int]"0x$($ta)"
$clientPort = 3000 + $taInt
$client = new-Object system.Net.Sockets.Udpclient $clientPort
}
catch
{
Write-Warning "$($Error[0])"
$client = new-Object system.Net.Sockets.Udpclient
}
$client.client.ReceiveTimeout = 5000
$client.Connect($sharesIpUdp, $port)
$requestData = "$($qloiws04LniataVdu)4e"
$bytes = Build-SharesMessage($requestData)
#$clientEndpoint = [IPEndPoint]($client.Client.LocalEndPoint)
$clientEndpoint = $client.Client.LocalEndPoint
[void]$client.Send($bytes, $bytes.length)
$endpoint = New-Object system.net.ipendpoint([system.net.ipaddress]::Any, 0)
$udpConnectivity = $false
$responseData
try
{
$bytes = $client.Receive( [ref]$endpoint )
$udpConnectivity = $true
$responseData = Convert-ByteArrayToHex $bytes
}
catch
{
$udpConnectivity = $false
# Write-Warning "UDP test result. FAIL. Error: $($Error[0])"
}
finally
{
$client.Close();
}
New-Object PsObject -Property @{
SHARES_Host = $sharesIpUdp
SHARES_Port = $port
HasConnectivity = $udpConnectivity
ClientEndpoint = "$($clientEndpoint.Address.IPAddressToString):$($clientEndpoint.Port)"
}
}
Write-Output "`r`n`r`nUDP CONNECTIVITY TEST:"
foreach ($port in $sharesUdpPorts)
{
$result = CheckUdp -port $port
$result -replace "[`r`n]+$", "" >$null
Write-Output $result
}
# $udpTestOut = "UDP Connectivity "
# if ($udpConnectivity)
# {
# $udpTestOut = "$($udpTestOut)True"
# }
# else
# {
# $udpTestOut = "$($udpTestOut)False"
# }
# Write-Output $udpTestOut

View File

@ -0,0 +1,3 @@
@echo off
powershell -ExecutionPolicy Bypass -File .\UAConnectivityCheck.ps1
pause

View File

@ -0,0 +1,44 @@
57.14.12.11 remotectx.ual.com
57.14.12.20 ft.ual.com
57.14.12.20 login-cu.ual.com
57.14.12.20 login-nam.ual.com
57.14.12.20 nam-esp.ual.com
57.14.12.20 webemd.ual.com
57.14.12.20 wingtips.ual.com
57.14.12.21 ual-login.ual.com
57.14.12.24 atw-dr.united.com
57.14.12.25 airportportalcu.ual.com
57.14.12.26 airportportalappscu.ual.com
57.14.12.122 rum-http-intake.logs.datadoghq.com
57.14.12.122 browser-http-intake.logs.datadoghq.com
57.14.12.122 unitedao-app.quantummetric.com
57.14.12.122 cdn.quantummetric.com
57.14.12.122 siteintercept.qualtrics.com
57.14.12.122 zn5ydlsbwpgrsccsp-qps.siteintercept.qualtrics.com
57.14.12.122 unitedonequestion.qualtrics.com
57.14.12.122 iad1.qualtrics.com
57.14.12.122 ne2jcmk532tpq2re-unitedonequestion.siteintercept.qualtrics.com
57.14.12.122 hcdn.walkme.com
57.14.12.122 ec.walkme.com
57.14.12.122 papi.walkme.com
57.14.12.122 c.go-mpulse.net
57.14.12.122 17de4c20.akstat.io
57.14.12.254 unimatic.common.use.ual.com
57.14.13.11 agentui2.ual.com
57.14.13.24 atw.united.com
57.14.13.25 airportportalcu-dr.ual.com
57.14.13.26 airportportalappscu-dr.ual.com
57.14.13.85 csmcbagapp.nam.coair.com
57.14.13.142 csmc.auth.united.com
57.14.13.143 csmc.api.united.com
57.14.13.144 csmc.secure.api.united.com
57.14.13.168 agentui.ual.com
57.14.13.168 agentui3.ual.com
57.14.13.169 agentui4.ual.com
57.14.13.169 agentui5.ual.com
57.14.13.169 agentuibeta.ual.com
57.14.13.188 aero.ual.com
57.14.13.226 agenttcdweb.ual.com
#57.228.112.12 csmcgaterdweb.nam.coair.com
10.232.100.72 csmcgaterdweb.nam.coair.com
204.26.248.58 tcp.shares.ual.com

View File

@ -0,0 +1,58 @@
10.232.100.72 csmcgaterdweb.nam.coair.com
204.26.248.58 tcp.shares.ual.com
57.14.12.103 rfp.ual.com
57.14.12.11 remotectx.ual.com
57.14.12.122 17de4c20.akstat.io
57.14.12.122 browser-http-intake.logs.datadoghq.com
57.14.12.122 c.go-mpulse.net
57.14.12.122 cdn.quantummetric.com
57.14.12.122 ec.walkme.com
57.14.12.122 hcdn.walkme.com
57.14.12.122 iad1.qualtrics.com
57.14.12.122 ne2jcmk532tpq2re-unitedonequestion.siteintercept.qualtrics.com
57.14.12.122 papi.walkme.com
57.14.12.122 rum-http-intake.logs.datadoghq.com
57.14.12.122 siteintercept.qualtrics.com
57.14.12.122 unitedao-app.quantummetric.com
57.14.12.122 unitedonequestion.qualtrics.com
57.14.12.122 zn5ydlsbwpgrsccsp-qps.siteintercept.qualtrics.com
57.14.12.20 bart.ual.com
57.14.12.20 esp.ual.com
57.14.12.20 ft.ual.com
57.14.12.20 login-cu.ual.com
57.14.12.20 login-nam.ual.com
57.14.12.20 nam-esp.ual.com
57.14.12.20 ndcespintranet.ual.com
57.14.12.20 uroc.ual.com
57.14.12.20 webemd.ual.com
57.14.12.20 wingtips.ual.com
57.14.12.21 ual-login.ual.com
57.14.12.24 atw-dr.united.com
57.14.12.25 airportportalcu.ual.com
57.14.12.254 unimatic.common.use.ual.com
57.14.12.26 airportportalappscu.ual.com
57.14.12.80 secureflight.ual.com
57.14.13.101 eservice.nam.coair.com
57.14.13.101 eservice.united.com
57.14.13.11 agentui2.ual.com
57.14.13.142 csmc.auth.united.com
57.14.13.143 csmc.api.united.com
57.14.13.144 csmc.secure.api.united.com
57.14.13.145 adocpss.nam.coair.com
57.14.13.153 jumppss.nam.coair.com
57.14.13.162 tktservicespss.nam.coair.com
57.14.13.167 ovspss.nam.coair.com
57.14.13.168 agentui.ual.com
57.14.13.168 agentui3.ual.com
57.14.13.169 agentui4.ual.com
57.14.13.169 agentui5.ual.com
57.14.13.169 agentuibeta.ual.com
57.14.13.188 dmlp.nam.coair.com
57.14.13.188 aero.ual.com
57.14.13.226 agenttcdweb.ual.com
57.14.13.24 atw.united.com
57.14.13.25 airportportalcu-dr.ual.com
57.14.13.26 airportportalappscu-dr.ual.com
57.14.13.72 csmcgaterdweb.nam.coair.com
57.14.13.85 csmcbagapp.nam.coair.com
57.228.112.12 csmcgaterdweb.nam.coair.com

View File

@ -0,0 +1,41 @@
10.232.100.72 csmcgaterdweb.nam.coair.com
204.26.248.58 tcp.shares.ual.com
57.14.12.11 remotectx.ual.com
57.14.12.122 17de4c20.akstat.io
57.14.12.122 browser-http-intake.logs.datadoghq.com
57.14.12.122 c.go-mpulse.net
57.14.12.122 cdn.quantummetric.com
57.14.12.122 ec.walkme.com
57.14.12.122 hcdn.walkme.com
57.14.12.122 iad1.qualtrics.com
57.14.12.122 ne2jcmk532tpq2re-unitedonequestion.siteintercept.qualtrics.com
57.14.12.122 papi.walkme.com
57.14.12.122 rum-http-intake.logs.datadoghq.com
57.14.12.122 siteintercept.qualtrics.com
57.14.12.122 unitedao-app.quantummetric.com
57.14.12.122 unitedonequestion.qualtrics.com
57.14.12.122 zn5ydlsbwpgrsccsp-qps.siteintercept.qualtrics.com
57.14.12.20 login-nam.ual.com
57.14.12.20 nam-esp.ual.com
57.14.12.20 wingtips.ual.com
57.14.12.21 ual-login.ual.com
57.14.12.24 atw-dr.united.com
57.14.12.25 airportportalcu.ual.com
57.14.12.254 unimatic.common.use.ual.com
57.14.12.26 airportportalappscu.ual.com
57.14.13.11 agentui2.ual.com
57.14.13.142 csmc.auth.united.com
57.14.13.143 csmc.api.united.com
57.14.13.144 csmc.secure.api.united.com
57.14.13.168 agentui.ual.com
57.14.13.168 agentui3.ual.com
57.14.13.169 agentui4.ual.com
57.14.13.169 agentui5.ual.com
57.14.13.169 agentuibeta.ual.com
57.14.13.188 aero.ual.com
57.14.13.226 agenttcdweb.ual.com
57.14.13.24 atw.united.com
57.14.13.25 airportportalcu-dr.ual.com
57.14.13.26 airportportalappscu-dr.ual.com
57.14.13.85 csmcbagapp.nam.coair.com
57.228.112.12 csmcgaterdweb.nam.coair.com

View File

@ -451,25 +451,25 @@ switch ($action) {
$data = Get-Data
foreach ($dataEntry in $data) {
$path = "$($hiveShort):\$($dataEntry.Key)"
# try {
# New-Item -Path $path -Force -ErrorAction Stop
# Write-Information "Imported key: $path"
# }
# catch {
# Write-Error "Failed to import key: $path"
# continue
# }
Write-Debug $path
try {
New-Item -Path $path -Force -ErrorAction Stop
Write-Information "Imported key: $path"
}
catch {
Write-Error "Failed to import key: $path"
continue
}
#Write-Debug $path
foreach ($valueItem in $dataEntry.ValueItems) {
# try {
# New-ItemProperty -Path $path -Name $valueItem.Name -Value $valueItem.Value -PropertyType 'String' -Force -ErrorAction Stop
# Write-Information "Imported value: $($valueItem.Name) in $path"
# }
# catch {
# Write-Error "Failed to create entry: $($valueItem.Name) in $path"
# continue
# }
Write-Debug "$($valueItem.Name)=$($valueItem.Value)"
try {
New-ItemProperty -Path $path -Name $valueItem.Name -Value $valueItem.Value -PropertyType 'String' -Force -ErrorAction Stop
Write-Information "Imported value: $($valueItem.Name) in $path"
}
catch {
Write-Error "Failed to create entry: $($valueItem.Name) in $path"
continue
}
#Write-Debug "$($valueItem.Name)=$($valueItem.Value)"
}
}
}

View File

@ -0,0 +1,86 @@
param (
[parameter(Mandatory=$false)]
[Alias('i')]
[switch]
$InteractiveMode = $false
)
$host.ui.RawUI.WindowTitle = "VC Redist Check"
$FoundMessage = 'Found! Detected Version {0}'
# Check the major version.
$VC_Runtimes_x86_Path = 'HKLM:\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\14.0\VC\Runtimes\x86';
Write-Host
Write-Host "Checking version number in $VC_Runtimes_x86_Path..."
$Major = 0
try {
$Major = Get-ItemPropertyValue -Path $VC_Runtimes_x86_Path -Name Major
}
catch {
}
if ($Major -ge 14) {
try {
$Minor = Get-ItemPropertyValue -Path $VC_Runtimes_x86_Path -Name Minor
}
catch {
$Minor = -1
}
$Version = $Major;
if ($Minor -ge 0) {
$Version += ".$Minor"
}
Write-Host
Write-Host ($FoundMessage -f $Version)
Write-Host
if ($InteractiveMode) {
Pause
}
return
}
# Check if installed.
$HklmBasePath = 'HKLM:\SOFTWARE\Classes\Installer\Dependencies'
#$HkcrBasePath = 'HKCR:\Installer\Dependencies\VC,redist.x86,x86,14.{0},bundle\Dpendents'
$HkcrBasePath = "$HklmBasePath\VC,redist.x86,x86,14.{0},bundle\Dependents"
$KeyHash = @{
"14.0" = "$HklmBasePath\{e2803110-78b3-4664-a479-3611a381656a}" #2015
"14.16" = "$($HkcrBasePath -f '16')\{67f67547-9693-4937-aa13-56e296bd40f6}" #2017
"14.21" = "$($HkcrBasePath -f '21')\{49697869-be8e-427d-81a0-c334d1d14950}" #2019 14.21
"14.22" = "$($HkcrBasePath -f '22')\{5bfc1380-fd35-4b85-9715-7351535d077e}" #2019 14.22
"14.24" = "$($HkcrBasePath -f '24')\{e31cb1a4-76b5-46a5-a084-3fa419e82201}" #2019 14.24
"14.36" = "$($HkcrBasePath -f '36')\{410c0ee1-00bb-41b6-9772-e12c2828b02f}" #2022
}
function IsInstalled {
$KeyHash.Keys | ForEach-Object {
Write-Host $KeyHash[$_]
$FoundKey = Test-Path $KeyHash[$_]
if ($FoundKey) {
return $_
}
}
}
$NotFoundMessage = 'Not found: Cannot confirm that VC++ Redistributable 2015 is installed.'
$Message = '';
Write-Host 'Checking known registry locations for installation...'
$Version = IsInstalled
if ($Version) {
$Message = $FoundMessage -f $Version
}
else {
$Message = $NotFoundMessage
}
Write-Host
Write-Host "$Message"
Write-Host
if ($InteractiveMode) {
Pause
}

View File

@ -0,0 +1,8 @@
@echo off
title VC Redist Check
setlocal
pushd %0\..
set "ROOT=%cd%"
powershell -ExecutionPolicy Bypass "%ROOT%\VcRedistCheck.ps1" %*
popd
endlocal