Skip to content

Instantly share code, notes, and snippets.

@gdyr
Last active July 21, 2022 13:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gdyr/86533963b6fe14ed9c57eb7ae0adba29 to your computer and use it in GitHub Desktop.
Save gdyr/86533963b6fe14ed9c57eb7ae0adba29 to your computer and use it in GitHub Desktop.
Monitor Cisco switch IGMP groups
function Get-CiscoIGMPGroups {
return plink -ssh cisco@10.10.10.17 -pw cisco -batch "sh ip igmp snooping groups | include 224.0.1.129" 2>$null | ? {$_.Length -gt 0};
}
Write-Output "Starting IGMP group monitoring."
Write-Output "Press any key to exit..."
Write-Output "";
$prevEntry = "";
do {
$entry = Get-CiscoIGMPGroups;
if($entry -ne $prevEntry) {
Write-Output "IGMP Group membership changed:"
Write-Output $((Get-Date).ToString().Trim());
if($entry.Length -gt 0) {
Write-Output $entry;
} else {
Write-Output "(group empty)";
}
}
$prevEntry = $entry;
Start-Sleep -Seconds 2;
} until ([System.Console]::KeyAvailable);
@gdyr
Copy link
Author

gdyr commented Jul 21, 2022

Usage: .\igmplog.ps1 | Tee-Object -FilePath IGMPLog.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment