Installing Check_MK agent on Windows host remotely

Posted: October 6, 2015 in Linux

This is extension of my prevoius post regrading Check_MK setup

Check_MK server,by default,doesn’t install check_mk agent on windows machines.

In this example we will create Samba share on Check_MK server (folder with Check_MK agent setup),map that share from Windows machine and install it on Windows server.The beauty is that we won’t login in to Windows server at all !!!.

I got valuable support from colleague of mine,Matija Resimic while creating material for this article

We will be using CentOS (Check_MK installed) to accomplish this task.

Creating Samba shares

root@nm- ~]#yum install samba

root@nm- ~]#vi /etc/samba/smb.conf


#======================= Global Settings =====================================




workgroup = MYGROUP

server string = Samba Server Version %v

netbios name = MYSERVER

interfaces = lo eth0

hosts allow = ALL

security = user

map to guest = bad user

Note:/opt/omd/versions/1.20/share/check_mk/agents/windows/ is default path for windows agents,I mapped windows folder.

/opt/omd/versions/1.20/share/check_mk/agents/windows/ is default path for windows agents,I mapped whole folder.



browseable = yes

public = yes

# create mask = 666

# directory mask = 777

valid users = root

writable = yes

guest ok = yes

read only = no

;       valid users = %S

;       valid users = MYDOMAIN\%S

Set samba password for root user:

[root@check_mk build]# smbpasswd -a root

New SMB password:

Restart smb service:

[root@check_mk build]# service smb restart

Always test if you can access Samba share from windows (username root,password mypassword-set by smbpasswd command)


If you have any errors check /var/log/samba/log.smbd

Note:if you’re using firewall,make sure ports 137,138,139 and 445 (TCP and UDP) are opened

Installing Winexe

Using WinExe we can connect to Command Prompt of remote Windows machine and perform any command as if we are sitting in front of windows server

First,install dependencies:

yum update
yum install samba-client
yum install git
yum install gcc
yum install perl
yum install mingw*
yum install libcom_err-devel
yum install popt-devel
yum install zlib-devel
yum install zlib-static
yum install glibc-devel
yum install glibc-static
yum install python-devel
yum install gnutls-devel
yum install libacl-devel
yum install openldap-devel
yum install samba-devel

then download WinExe:

root@nm- ~]#git clone winexe

After executing this command,new folder,winexe will appear,

cd to source folder (inside winexe)

Waf is a python script located at the root of any project directory. It is invoked by calling the script like a shell script.For more info click here

[root@check_mk tmp]# cd winexe/source/
[root@check_mk source]# ./waf configure build


Navigate to folder build:


[root@check_mk build ]# ./winexe --user=\administrator%MyPass // --system 'cmd /c net use X: \\\check_mk MyPassword /USER:root /P:yes & X: & start /wait install_agent.exe /S & net use x: /delete /yes'

We’re connecting to remote windows server with IP username administrator,password MyPass,mapping Samba share as X drive (\\\check_mk) with user root,password MyPassword,then CD into that share (X:),install check_mk agent (start /wait install_agent.exe /S) /S install silently and after installation,delete X share (net use x: /delete /yes)

Note that every of these commands are separated by &

First command:connect to remote Windows machine ( and map share from Samba server ( using username root and password MyPassword and X letter

–user=\administrator%MyPass // –system ‘cmd /c net use X: \\\check_mk MyPassword /USER:root /P:yes

Second command:go into X: share


Third command:install check_mk agent silently:

start /wait install_agent.exe /S

Fourth command,delete Samba share

net use x: /delete /yes’

In this way,we installed check_mk agent on remote Windows server without connecting to it,of course,we need to know server’s IP address and credentials

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s