Send custom popup message to endpoint

Hi,

Please use below procedure to send popup messages to endpoints,

import os;
import ctypes
class disable_file_system_redirection:
    _disable = ctypes.windll.kernel32.Wow64DisableWow64FsRedirection
    _revert = ctypes.windll.kernel32.Wow64RevertWow64FsRedirection
    def __enter__(self):
        self.old_value = ctypes.c_long()
        self.success = self._disable(ctypes.byref(self.old_value))
    def __exit__(self, type, value, traceback):
        if self.success:
            self._revert(self.old_value)
input_text= "Free Service Ends Today. Please subscribe to continue services"
command='msg * '+input_text+' '
with disable_file_system_redirection():
    out=os.popen(command).read();
    print(out);

custom_message_box.txt (665 Bytes)

Dont work at Windows 8.1 (both - logged user and system user)

Hello @Sergey ,

We will forward your reply to the development and we will get back to you as soon as we have an outcome.

Dont work with russian symbols - break encoding. Symbols are not readable.

After I edited message text - it dont work at all :frowning:

Hello @Sergey,

Thank you for the additional information, I have forwarded it to the appropriate staff and we will reach back to you as soon as possible.

Hi @Sergey

Dont work at Windows 8.1 (both - logged user and system user)

Windows 8.1 has security permission issues with meg tool . it is resolved now.

Dont work with russian symbols - break encoding. Symbols are not readable.

Russian symbols support has been enabled with the modified procedure.

Please refer updated procedure for you as below,


display_text= "Бесплатная служба заканчивается сегодня. Пожалуйста, подпишитесь, чтобы продолжить услуги"
import os; 
import ctypes
class disable_file_system_redirection:
    _disable = ctypes.windll.kernel32.Wow64DisableWow64FsRedirection
    _revert = ctypes.windll.kernel32.Wow64RevertWow64FsRedirection
    def __enter__(self):
        self.old_value = ctypes.c_long()
        self.success = self._disable(ctypes.byref(self.old_value))
    def __exit__(self, type, value, traceback):
        if self.success:
            self._revert(self.old_value)

bypass='reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server" /v AllowRemoteRPC /t REG_DWORD /d 1  /f '
command='msg * '+display_text+' '

with disable_file_system_redirection():
    permission=os.popen(bypass).read(); 
    print(permission);
    code=os.popen('CHCP  866').read();
    print(code);
    out=os.popen(command).read();
    print(out);


Please let us know your feedback.

Custom_message_box_update.txt (1.01 KB)

Now message showed at all PCs, but (Windows 7, WIndows 10) encoding problem remains. CP 866 and 1251.
And about windows caption - how to change it?

Maybe problem at browser/OS side? At what encoding C1 get text from me?

I tried to use this solution but it did not error or display.

Your language?

Hi @Sergey and @sbizit

Please refer blow script to send custom message notifications to logged in users.


# -*- coding: utf-8 -*-
import Tkinter
import tkMessageBox
window = Tkinter.Tk()
window.wm_withdraw()
tkMessageBox.showinfo(title="Notification", message="Бесплатная служба заканчивается сегодня. Пожалуйста, подпишитесь, чтобы продолжить услуги")

Note:
1.Script must be executed as logged in user
2.Script will wait for logged in user until he/she click ‘OK’ and then send success status to ITSM.
3.It support non English characters
4. Please set title and message variable string as per your wish.

Thanks,
Kannan

20170131-Custom-message-notification-for-logged-in-user.json (1.14 KB)

Hi @Sergey

Could you share Operating System details of PCs where no popup messages observed ?

Thanks
Kannan

Hi @Sergey it is English.
Thank you @mkannan the revised code works as expected on Windows 10 in my tests.

not working with newest version of C1
File “”, line 4, in
File “C:\Program Files (x86)\COMODO\Comodo ITSM\lib\lib-tk\Tkinter.py”, line 1814, in init
self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: Can’t find a usable init.tcl in the following directories:
{C:/Program Files (x86)/COMODO/Comodo ITSM/lib/tcl8.5} {C:/Program Files (x86)/COMODO/lib/tcl8.5} {C:/Program Files (x86)/lib/tcl8.5} {C:/Program Files (x86)/COMODO/library} {C:/Program Files (x86)/library} {C:/Program Files (x86)/tcl8.5.19/library} C:/tcl8.5.19/library

C:/Program Files (x86)/COMODO/Comodo ITSM/lib/tcl8.5/init.tcl: version conflict for package “Tcl”: have 8.5.19, need exactly 8.5.15
version conflict for package “Tcl”: have 8.5.19, need exactly 8.5.15
while executing
“package require -exact Tcl 8.5.15”
(file “C:/Program Files (x86)/COMODO/Comodo ITSM/lib/tcl8.5/init.tcl” line 19)
invoked from within
“source {C:/Program Files (x86)/COMODO/Comodo ITSM/lib/tcl8.5/init.tcl}”
(“uplevel” body line 1)
invoked from within
“uplevel #0
[list source $tclfile]”

This probably means that Tcl wasn’t installed properly.

Hi @hytekcomputers

Thank you for notifying us of this issue. We will check and update you.

Hi @hytekcomputers

I will update with working script soon.

Thanks,
Kannan

Hi @hytekcomputers,

We have reported this to our developers and we will inform you the status as soon as possible.

In the meantime, we recommend you to use the script to send custom pop-up message to the endpoint user (who is currently logged in)

Please follow the below instruction for the script,
Run the script as Logged in User
The script execution will complete only when the endpoint user responds to the custom message, so the execution log will only be displayed after the endpoint user responds to the message box.
You can modify the title of the message box on the variable - title=“your title”
You can modify the message of the message box on the variable - message=“your message”

message="Hi, Please leave your computer from 1PM to 2PM, We need to do some maintenance activities." ## Does not support multi line message.
title="Message from: Administrator"
def ecmd(CMD, OUT=False):
    import ctypes
    class disable_file_system_redirection:
        _disable = ctypes.windll.kernel32.Wow64DisableWow64FsRedirection
        _revert = ctypes.windll.kernel32.Wow64RevertWow64FsRedirection
        def __enter__(self):
            self.old_value = ctypes.c_long()
            self.success = self._disable(ctypes.byref(self.old_value))
        def __exit__(self, type, value, traceback):
            if self.success:
                self._revert(self.old_value)
    from subprocess import PIPE, Popen
    with disable_file_system_redirection():
        OBJ = Popen(CMD, shell = True, stdout = PIPE, stderr = PIPE)
    out, err = OBJ.communicate()
    ret=OBJ.returncode
    return ret

def wfile(fp, c):
    import os
    with open(fp, 'w') as f:
        f.write(c)
    if os.path.isfile(fp):
        return fp
    return

import os
c1=r'''MsgBox "%s", 4096, "%s"'''%(message, title)
pm=os.path.join(os.environ['TEMP'], 'messagealert.vbs')
filem=wfile(pm, c1)
if ecmd('cscript "%s"'%filem)==0:
    print 'The following message is sent the user.
%s'%message
else:
    print 'Error on sending message to the user'
os.remove(filem)

The script in JSON Format:

Sample Message Box:
​​

Sample Execution Log:

20170427-Send-Custom-Message-to-User.json (2.2 KB)

Screenshot_3.png

Screenshot_1.png

Much Appreciated!

Hi, not working today: i see a black CMD box pop up but no message.

Finished success Error on sending message to the user