Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Add IP show to script

$
0
0

Hello !

I'm trying to integrate a IP show on this script , can anyone help me please?

Best regards

strcomputer = inputbox("Enter Computer Name or IP")
if strcomputer = "" then
    wscript.quit
else

'ping it!
Set objPing = GetObject("winmgmts:{impersonationLevel=impersonate}").ExecQuery _
    ("select * from Win32_PingStatus where address = '" & strcomputer & "'")
For Each objStatus in objPing
    If IsNull(objStatus.StatusCode) or objStatus.StatusCode<>0 Then
        'request timed out
        msgbox(strcomputer & " did not reply" & vbcrlf & vbcrlf & _
    "Please check the name and try again")
    else
        'who's there?
        set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & _
    strComputer & "\root\cimv2")
        Set colSettings = objWMIService.ExecQuery("Select * from Win32_ComputerSystem")
        For Each objComputer in colSettings
            msgbox("System Name: " & objComputer.Name & vbcrlf & "User Logged in : " & _
objcomputer.username  & vbcrlf & "Domain: " & _
objComputer.Domain & vbcrlf & "Power: " & objComputer.DNSHostName)
        Next
    end if
next
end if


Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>