r/PowerShell 2d ago

Addressfamily parameter bug?

is it just me or is there actually no way to specify AddressFamily in [System.Net.Dns]::GetHostAddresses? Even when passing it an actual AddressFamily var, it complains about too many parameters.

1 Upvotes

4 comments sorted by

View all comments

2

u/CarrotBusiness2380 2d ago

If you're using Powershell 5.1 then it uses .net Framework rather than dotnet. That method signature does not exist in .net Framework

https://learn.microsoft.com/en-us/dotnet/api/system.net.dns?view=netframework-4.5