Jump to content

Fetch IPV6 address for remote machines using Get-NetIPAddress


Recommended Posts

Get-NetIPAddress -AddressFamily IPv6 -AddressState Preferred -SuffixOrigin DHCP | Select IPAddress

Experts am using above script to fetch IPV6 address information for remote machines it works for some machines but for some machines its throwing the below error upon checking the machine doesn't have DHCP suffix origin ,so here my question is why its throwing below error what does suffixorigin DHCP will do?? its throwing error because ipv6 not enabled?? 




Below error which we receive most commonly and the IPv6 Address field is Empty

Get-NetIPAddress : No matching MSFT_NetIPAddress objects found by CIM query for instances of the ROOT/StandardCimv2/MSFT_NetIPAddress class on the CIM server: SELECT * FROM MSFT_NetIPAddress WHERE ((AddressFamily = 23)) AND ((SuffixOrigin = 3)) AND ((AddressState = 4)). Verify query parameters and retry. At C:\ProgramData\Nexthink\RemoteActions\Scripts\System{2CC0A4D5-9D34-40F9-939D-1EA45AA63609}.ps1:28 char:11 + $ipv6 = ( Get-NetIPAddress -AddressFamily IPv6 -AddressState Preferre ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (MSFT_NetIPAddress:String) [Get-NetIPAddress], CimJobException + FullyQualifiedErrorId : CmdletizationQuery_NotFound,Get-NetIPAddress

Unable to write output 'IPV6Address' with given value '' interpreted as System.String: Object reference not set to an instance of an object. Warning: output '' has not been set by script


Link to comment
Share on other sites

  • Moderators

Moved to the most appropriate forum, although @Vignesh I would ask why you're asking a powershell question on an AutoIt forum. 😕

And from the error, it is not returning what you're after, most likely the -AddressFamily. Are you sure every single computer is configured with an IPv6 address? Either way, you should be doing some actual error checking by surrounding your Get-NetIPAddress call in a try/catch block.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

  • 2 weeks later...


welcome to the forums

Try using my the all new GetTable function I have posted out today @using this command

$aArray = GetTable("NetIPAddress -AddressFamily IPv6 -AddressState Preferred")

And let us know how that works for you




Edited by Deye
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...