Skip to content

Commit

Permalink
Enhanced comments within the scripts
Browse files Browse the repository at this point in the history
and add website link
  • Loading branch information
FletcherS7 committed Oct 19, 2024
1 parent f837e83 commit f21c83b
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 17 deletions.
35 changes: 19 additions & 16 deletions FFS_Connect.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,26 @@ echo " / /_ / /_ \__ \ / / / / / / |/ / |/ / __/ / / / / "
echo " / __/ / __/ ___/ / / /___/ /_/ / /| / /| / /___/ /___ / / "
echo "/_/ /_/ /____/ \____/\____/_/ |_/_/ |_/_____/\____/ /_/ "
echo " "
echo "FFS Connect (This version from 2023-11-26)"
echo "FFS Connect (This version from 2024-10-19)"
echo "Created by Fletcher Salesky"
#Display current firewall settings
#A PowerShell script that performs the most common fixes for Driver Station communication issues to the FIRST Robotics Competition Field Managment System Field Network.
#Learn more about this script, get updates, and contribute at https://driverstation.app

#Display current firewall settings.
Get-NetFirewallProfile | Format-List -Property Profile, Enabled

#DISABLE ALL WINDOWS FIREWALLS
#DISABLE ALL WINDOWS FIREWALLS to allow communication to the FIRST Robotics Competition Field Managment System (FMS).
Set-NetFirewallProfile -Profile Domain,Public,Private -Enabled False
echo "Disabled Windows Firewall"

#Create Firewall allow rules for FRC FMS Ports (Ports from FMS White Paper, WPIlib and The FTAA/CSA Troubleshooting)
#Create Firewall allow rule for NI mDNS Responser
#Create Firewall allow rules for FIRST Robotics Competition Field Managment System (FMS) Ports (Ports from the Season Game Manual, FMS White Paper, WPIlib Docs and the FTAA/CSA Troubleshooting).
#Create Firewall allow rule for National Instruments mDNS Responser.
function Install-Firewall-Rules
{
echo "Checking if Firewall Rules already exist"
$rule = Get-NetFirewallRule -Group "Allow FRC Driver Station FMS Comms" 2> $null;
if ($rule) {
#enable-update rules if they exist
#enable-update rules if they exist.
echo "Existing rules found, Updated and Enabled Firewall Rules"
Set-NetFirewallRule -Name FRC_Driver_Station_FMS_Comms_TCP_in -Direction Inbound -Protocol TCP -RemoteAddress 10.0.0.0/8 -LocalPort 80,443,554,1110,1115,1120,1122,1130,1140,1150,1160,1180-1190,1250,1735,1740,1741,1750,5353,5800-5810,6666,8080,8888 -Action Allow -Enabled True -Profile Any
Set-NetFirewallRule -Name FRC_Driver_Station_FMS_Comms_UDP_in -Direction Inbound -Protocol UDP -RemoteAddress 10.0.0.0/8 -LocalPort 80,443,554,1110,1115,1120,1122,1130,1140,1150,1160,1180-1190,1250,1735,1740,1741,1750,5353,5800-5810,6666,8080,8888 -Action Allow -Enabled True -Profile Any
Expand All @@ -32,7 +35,7 @@ function Install-Firewall-Rules
}

else {
#create rules if they do not exist
#create rules if they do not exist.
echo "Rules do not exist, Creating Firewall Rules"
New-NetFirewallRule -Name FRC_Driver_Station_FMS_Comms_TCP_in -Group "Allow FRC Driver Station FMS Comms" -DisplayName "FRC Driver Station FMS Comms TCP" -Direction Inbound -Protocol TCP -RemoteAddress 10.0.0.0/8 -LocalPort 80,443,554,1110,1115,1120,1122,1130,1140,1150,1160,1180-1190,1250,1735,1740,1741,1750,5353,5800-5810,6666,8080,8888 -Action Allow -Profile Any
New-NetFirewallRule -Name FRC_Driver_Station_FMS_Comms_UDP_in -Group "Allow FRC Driver Station FMS Comms" -DisplayName "FRC Driver Station FMS Comms UDP" -Direction Inbound -Protocol UDP -RemoteAddress 10.0.0.0/8 -LocalPort 80,443,554,1110,1115,1120,1122,1130,1140,1150,1160,1180-1190,1250,1735,1740,1741,1750,5353,5800-5810,6666,8080,8888 -Action Allow -Profile Any
Expand All @@ -44,14 +47,14 @@ function Install-Firewall-Rules
}
}

#Enable the Firewall rules to allow comms to the field network
#Enable the Firewall rules to allow communications to the FIRST Robotics Competition Field Managment System (FMS) field network.
Install-Firewall-Rules
echo "Firewall Opened to FRC Protocols"

#Display current firewall settings
Get-NetFirewallProfile | Format-List -Property Profile, Enabled

#Stop Windows updates
#Stop Windows updates Service to prevent updates during a FIRST Robotics Competition match.
net stop wuauserv
echo "Windows Update Service Stopped"
echo " "
Expand All @@ -62,7 +65,7 @@ pause
#Get All Adapters
$adapters = Get-NetAdapter

#Disable all adapters
#Disable and reset all adapters to resolve adapter issues
foreach ($adapter in $adapters)
{
Disable-NetAdapter -name $adapter.Name -Confirm:$false
Expand All @@ -71,7 +74,7 @@ foreach ($adapter in $adapters)
#Get Physical Adapters
$physicalAdapters = Get-NetAdapter -Physical

#Enable Physical 802.3 Adapters and Disable IPv6 on Physical 802.3 Adapters
#Enable Physical 802.3 Adapters and Disable IPv6 on Physical 802.3 Adapters becuase devices connect to the FIRST Robotics Competition Field Managment System (FMS) field network via ethernet using IPv4.
foreach ($adapter in $physicalAdapters)
{
if ($adapter.PhysicalMediaType -like "*802.3")
Expand All @@ -81,7 +84,7 @@ foreach ($adapter in $physicalAdapters)
}

}
echo "Wireless Adapters Disabled, Ethernet Adapters Reset"
echo "Wireless Adapters and IPv6 Disabled, Ethernet Adapters Reset"
#Show Status of Adapters
Get-NetAdapter | Format-List -Property Name,Status,AdminStatus,HardwareInterface

Expand All @@ -101,11 +104,11 @@ foreach ($adapter in $physicalAdapters)

#Flush DNS
Clear-DnsClientCache
echo "DNS Flushed"
#Release everything
echo "DNS Cache Flushed"
#Release all DCHP leases
ipconfig /release
ipconfig /release6
echo "IP Addresses Released"
echo "All DHCP Leases Released"

#Ask to open Network Adapters Control Panel to allow Static IP setting instead of using DHCP
$confirmation = Read-Host "Open Network Adapters Control Panel to set Static IP? [Y/N]"
Expand Down Expand Up @@ -134,7 +137,7 @@ foreach ($adapter in $physicalAdapters)
}

}
Echo "Ethernet Adapter IP Addresses Renewed"
Echo "Ethernet Adapter DHCP Lease Renewed"

Start-Sleep -s 2

Expand Down
5 changes: 4 additions & 1 deletion Launch_FFS_ConnectPS.bat
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
@echo off
rem Created by Fletcher Salesky
rem FFS Connect Powershell Launcher (This verson from 2021-10-06)
rem FFS Connect Powershell Launcher (This verson from 2024-10-19)
rem Launcher for a PowerShell script that performs the most common fixes for Driver Station communication issues to the FIRST Robotics Competition Field Managment System Field Network.
rem Learn more about this script, get updates, and contribute at https://driverstation.app

rem FRC FMS Station Connect to The Field
Title FFS Connect to The Field
rem fancy color
color 06
Expand Down

0 comments on commit f21c83b

Please sign in to comment.