Experts i need some clarification on the below script

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

The above script working fine on some machines it will fetch current ipv6 address on machines it throws below error for some machines upon checking found it works for machine which as suffix origin which has DHCP,can someone help to find what actually it indicates whether ipv6 not enabled or else???


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

What is the PowerShell version here ?
Did you upgrade PowerShell in this system ?