Guest User

Untitled

a guest
Nov 19th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 KB | None | 0 0
  1. Dim strQuery, strMac, url, args, status, dateStamp
  2. Set args = WScript.Arguments
  3.  
  4. If args.Count < 1 Then
  5. Wscript.Echo "Can't send empty status"
  6. Wscript.Quit
  7. End If
  8.  
  9. status = args.Item(0)
  10.  
  11. msg = ""
  12. If args.Count > 1 Then
  13. For i = 1 to args.Count - 1
  14. msg = msg & " " & args.Item(i)
  15. Next
  16. msg = LTrim(msg)
  17. End If
  18.  
  19. url_status_internal="__URL_STATUS_INTERNAL__"
  20. url_status_external="__URL_STATUS_EXTERNAL__"
  21.  
  22.  
  23. strMAC = ""
  24. ' We're interested in MAC addresses of physical adapters only
  25. strQuery = "SELECT * FROM Win32_NetworkAdapter WHERE NetConnectionID > ''"
  26.  
  27. Set objWMIService = GetObject( "winmgmts://./root/CIMV2" )
  28. Set colItems = objWMIService.ExecQuery( strQuery, "WQL", 48 )
  29.  
  30. For Each objItem In colItems
  31. If InStr( strMAC, objItem.MACAddress ) = 0 Then
  32. strMAC = objItem.MACAddress
  33. 'We only want the first MAC found
  34. Exit For
  35. End If
  36. Next
  37.  
  38. If status = "FIRSTBOOT" OR status = "ERROR_INSTALL_SOFTWARES" Then
  39. url = url_status_external
  40. Else
  41. url = url_status_internal
  42. End If
  43.  
  44. If msg = "" Then
  45. urlString = url & "?mac=" & strMAC & "&status=" & status
  46. Else
  47. urlString = url & "?mac=" & strMAC & "&status=" & status & "&msg=" & msg
  48. End If
  49.  
  50. Dim httpObject
  51. Set httpObject = CreateObject("MSXML2.XMLHTTP")
  52. httpObject.open "GET", urlString, False
  53. httpObject.send
Add Comment
Please, Sign In to add comment