WinBatch® Technical Support Forum

All Things WinBatch => WinBatch => Topic started by: morenos1 on September 18, 2014, 07:42:08 AM

Title: Code translation.
Post by: morenos1 on September 18, 2014, 07:42:08 AM
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
Title: Re: Code translation.
Post by: morenos1 on September 18, 2014, 08:02:37 AM
I go it.

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

Thanks...
Title: Re: Code translation.
Post by: morenos1 on September 18, 2014, 08:11:46 AM
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""",,,)
Title: Re: Code translation.
Post by: MW4 on September 18, 2014, 11:22:55 AM
pretty cool code snip....now...how to get to to work over a WAN?