diff --git a/set_app_domain.py b/set_app_domain.py
index 1b859d3b8cc90a1b7891ca649cc2921ae72a2800..9c89be863d96a26178b67ac579faad73d6f1abee 100755
--- a/set_app_domain.py
+++ b/set_app_domain.py
@@ -3,6 +3,7 @@
 '''
 Script to set the domain of an existing MediaServer, Miris Manager or Monitor
 '''
+import apt
 import os
 import re
 import subprocess
@@ -162,7 +163,13 @@ class SetAppDomain():
                 with open('/etc/hosts', 'w') as fo:
                     fo.write(new_hosts)
                 log('The "/etc/hosts" file has been update.')
-                utils.run_commands(['service nscd restart'])
+                cache = apt.Cache()
+                cache.open()
+                try:
+                    cache['nscd'].is_installed
+                    utils.run_commands(['service nscd restart'])
+                except KeyError:
+                    pass
         else:
             log('The "/etc/hosts" file is already up to date.')