Code translation.

Started by morenos1, September 18, 2014, 07:42:08 AM

Previous topic - Next topic

morenos1

I am trying to find the correct translation for:

;dim WMIObj, strHost, intProcessID

;on error resume next

;strHost = "remotehost.domain.com"

;set WMIObj = GetObject("winmgmts:\\" & strHost & "\root\cimv2:Win32_Process")
;if IsObject(WMIObj) then

    ;I need the right Winbatch translation for this next line:

    ;WMIObj.Create "cmd.exe /C msg * ""ha-ha-ha""", null, null, intProcessID    ;Need Winbatch syntax .....

;end if

;set WMIObj = nothing

;Winbatch next

ComputerName = "olisws00"

objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\%ComputerName%\root\cimv2")

objWMIService.Create("cmd.exe /C msg * ""ha-ha-ha"","","","")      ;Needs correct syntax

morenos1

I go it.

objWMIService.Create("cmd.exe /C msg * ""ha-ha-ha""",,,)

Thanks...

morenos1

This WMI code actually works to send a message to other computers ....

ComputerName = "computer"

objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\%ComputerName%\root\cimv2:Win32_Process")

objWMIService.Create("cmd.exe /C msg * ""ha-ha-ha""",,,)

MW4

pretty cool code snip....now...how to get to to work over a WAN?