Sometimes we need the agility of PowerShell to execute simple Azure Network Watcher tasks. In this blog post, we are going to cover the steps required to use the Next Hop tool.
The following PowerShell script can be used to perform the same task that we have just done in the Azure Portal.
$nw = Get-AzNetworkWatcher -Name NetworkWatcher_canadacentral -ResourceGroupName NetworkWatcherRG $vm = get-azvm -Name vqa1psarisql01 Get-AzNetworkWatcherNextHop -NetworkWatcher $nw -TargetVirtualMachineId $vm.Id -SourceIPAddress <Source-IP> -DestinationIPAddress <Destination-IP>
The result will be three columns: Next Hop Type, Next Hop IP Address, and Route Table ID.
Featured image: Shutterstock
More PowerShell Basics articles
- Neat trick: Organizing and formatting messy PowerShell output
- Adding help to your custom PowerShell cmdlets: Step-by-step guide
- Manage Microsoft Teams quickly and easily with PowerShell
- Building custom PowerShell cmdlets the easy way with modules
- Adding custom error messages to your PowerShell scripts