MicrosoftDocs / feedback

📢 docs.microsoft.com site feedback
https://learn.microsoft.com
Creative Commons Attribution 4.0 International
239 stars 160 forks source link

VBScript win32_PingStatus with ResolveAddressNames = 'true' under Windows 10 doesn't work #3349

Open Vadimpa opened 3 years ago

Vadimpa commented 3 years ago

Sample:

function Alive(sHost, ByRef IP, ByRef FQDN) dim objPing, obj Alive = false FQDN = sHost IP = sHost on error goto 0 set objPing = GetObject("winmgmts:{impersonationLevel=impersonate}")._ ExecQuery("select * from Win32_PingStatus where address = '" & sHost & "' and ResolveAddressNames = 'true'") for each obj in objPing Alive = Not ((IsNull(obj.StatusCode) or obj.StatusCode <> 0)) IP = obj.ProtocolAddress if obj.PrimaryAddressResolutionStatus = 0 then FQDN = obj.ProtocolAddressResolved exit for next set objPing = nothing end function

dim sHost:sHost = "8.8.8.8" dim sDNSName dim sIP

if Alive(sHost, sIP, sDNSName) then wscript.echo "host = " & sHost & ", ip = " & sIP & ", DNS name = " & sDNSName else wscript.echo " host " & sHost & " is not alive" end if

worked on windows 7-, but doesn't worked on windows 10

Why?

welcome[bot] commented 3 years ago

Thank you for creating the issue! One of our team members will get back to you shortly with additional information. If this is a product issue, please close this and contact the particular product's support instead (see https://support.microsoft.com/allproducts for the list of support websites).

rootsmusic commented 3 years ago

@Vadimpa Where's the doc?