Normally this isn't much of an issue, but for some outgoing connections you want to use a specific IP address on your server that has many IP addresses set. An example might be if you have a VPN set up to a remote location and you want to whitelist one IP address, not every single IP address on that server. Windows does not use the first IP address you set in the Network Properties. It instead chooses from that and all alternative IP addresses and guesses what the best one might be to use. This is sometimes not the one you want to use. And if you added an IP address in the future, who's to say it will stay the same and not choose a different one? Then the above firewall rule would become broken.
Well, luckily, PowerShell to the rescue. There is a property on all IP addresses called "Skip As Source" which is not exposed through the GUI. What it does is allow you exclude an IP address from consideration as the primary / outgoing IP address. You can use Set-NetIPAddress to assign this manually, but we can do better. Using a couple lines of PowerShell, you can create a ps1 script and then run it via a Scheduled Task, say, hourly, so that if at any time in the future you add a new IP address, the primary IP will consistently be correct, at least within an hour.
The script looks like this. Assuming the IP address you want to be primary is 192.168.33.129.
$primaryIP = "192.168.33.129"
Set-NetIPAddress -IPAddress $primaryIP -SkipAsSource $false
Get-NetAdapter | Get-NetIPAddress | ? { $_.IPAddress -ne $primaryIP } | % {
Set-NetIPAddress -IPAddress $_.IPAddress -SkipAsSource $true
}
Now all IP addresses, except the one you are designating as "primary," will be excluded from consideration as primary. We can verify this using...
Get-NetAdapter | Get-NetIPAddress | Select-Object IPAddress,SkipAsSource
Now if you save that segment to a PS1 file, then schedule it to run hourly using the SYSTEM account, your primary IP address is now automated.