Domain Services for Windows Health Check Tool

1 Likes
This tool will check the status of the services that should be running and report accordingly.

#!/bin/bash

. /opt/novell/eDirectory/bin/ndspath > /dev/null 2>&1
export LDAPCONF=/etc/opt/novell/xad/openldap/ldap.conf
clear
echo -e "################################################################################################################################## \n"
echo -e "********************* DSfW Domain Controller Sanity Check ********************* \n"
echo -e "################################################################################################################################## \n"
LDAPCONF=/etc/opt/novell/xad/openldap/ldap.conf /usr/bin/ldapsearch -Y EXTERNAL -b '' -s base dn -LLL > /dev/null 2>&1
if [ $? == "0" ]
then
echo -e "1. LDAPI interface working \n"
else
echo -e "1. LDAPI interface *NOT* working \n"
exit 1;
fi

host=`/bin/hostname`
domain=`perl -e '$dom = \`/bin/dnsdomainname\`; print uc($dom);'`

provision --locate-dc $domain > /dev/null 2>&1
if [ $? == "0" ]
then
echo -e "2. Domain Controller is located and working \n"
else
echo -e "Domain Controller is *NOT* located \n"
exit 1;
fi


echo novell | /opt/novell/xad/bin/kinit Administrator@$domain > /dev/null 2>&1
if [ $? == "0" ]
then
echo -e "3. kinit working \n"
else
echo -e "3. kinit *NOT* working \n"
exit 1;
fi

SASL_PATH=/opt/novell/xad/lib/sasl2 /usr/bin/ldapsearch -H ldap://$host.$domain -Y GSSAPI -b '' -s base dn -LLL > /dev/null 2>&1
if [ $? == "0" ]
then
echo -e "4. LDAP SASL-GSSAPI bind working \n"
else
echo -e "4. LDAP SASL-GSSAPI bind *NOT* working \n"
exit 1;
fi

/usr/bin/rpcclient -k localhost -c dsroledominfo > /dev/null 2>&1
if [ $? == "0" ]
then
echo -e "5. rpcclient working \n"
else
echo -e "5. rpcclient *NOT* working \n"
exit 1;
fi

adminSID=`wbinfo -n administrator | cut -f 1 -d ' '`
if [ "$adminSID" == "" ]
then
echo -e "6. wbinfo: name to SID conversion *NOT* working \n"
exit 1;
else
echo -e "6. wbinfo: name to SID conversion working \n"
fi

adminuid=`wbinfo -S $adminSID`
if [ "$adminuid" == "" ]
then
echo -e "7. wbinfo: SID to uid conversion *NOT* working \n"
exit 1;
else
echo -e "7. wbinfo: SID to uid conversion working \n"
fi

wbinfo -s $adminSID > /dev/null 2>&1
if [ $? == "0" ]
then
echo -e "8. wbinfo: SID to name conversion working \n"
else
echo -e "8. wbinfo: SID to name conversion *NOT* working \n"
exit 1;
fi

tmp=`wbinfo -U $adminuid | grep S-1-5-21`
if [ "$tmp" == "" ]
then
echo -e "9. wbinfo: UID to name conversion *NOT* working \n"
exit 1;
else
echo -e "9. wbinfo: UID to name conversion working \n"
fi


smbclient -k -L $host.$domain > /dev/null 2>&1
if [ $? == "0" ]
then
echo -e "10. smbclient working \n"
else
echo -e "10. smbclient *NOT* working \n"
exit 1;
fi

echo -e "##################################################################################################################################"
#If any of these doesn't work run "dcmake nds_restart_services"

Labels:

Collateral
Comment List
Anonymous
Related Discussions
Recommended