Broadcast Engineer Windows Scripts

Here are some helpful Windows scripts for broadcast engineers to automate tasks such as disabling updates, managing network connections, cleaning up files, and monitoring disk space.

1. Disable Windows Updates on Boot

This script disables the Windows Update service on boot to prevent system interruptions due to automatic updates.

PowerShell:
# Disable Windows Update Service on boot
$service = Get-Service -Name "wuauserv"
if ($service.Status -eq 'Running') {
    Stop-Service -Name "wuauserv" -Force
}
Set-Service -Name "wuauserv" -StartupType Disabled

2. Network Latency Test

This PowerShell script allows you to test the network latency to a specific server or IP address, helpful for ensuring streaming stability.

PowerShell:
# Test network latency to a specific server or IP
$server = "8.8.8.8"  # Change this to your streaming server IP or domain
Test-Connection -ComputerName $server -Count 10 | Measure-Object ResponseTime -Average

3. Automate Audio Recording Cleanup

This batch script automatically deletes audio recordings older than 30 days from a specific folder, helping manage disk space.

Batch:
:: Delete audio recordings older than 30 days
set folderPath=C:\Recordings
forfiles /p %folderPath% /s /m *.* /d -30 /c "cmd /c del /q @path"

4. Ping and Reboot Router

This batch script checks if a router is down and reboots it if necessary. Adjust the IP address to your router's IP.

Batch:
@echo off
set IP=192.168.1.1  :: Set this to the router's IP
ping %IP% -n 2 >nul
if errorlevel 1 (
    echo Router down. Rebooting...
    shutdown /r /m \\%IP% /t 5 /f
) else (
    echo Router is up.
)

5. Check Disk Space and Send an Alert

This PowerShell script monitors disk space on a drive and sends an email alert if it falls below a set threshold, which is important for storage management.

PowerShell:
$threshold = 20GB
$drive = Get-PSDrive -Name C
if ($drive.Used -gt ($drive.Size - $threshold)) {
    Send-MailMessage -From "admin(at)broadcast(dot)com" -To "engineer(at)broadcast(dot)com" -Subject "Low Disk Space" -Body "Drive space on $($drive.Name) is below $threshold" -SmtpServer "smtp.yourserver.com"
}