Posted On March 31, 2019

Servers Reboot Script

kimconnect 0 comments
blog.KimConnect.com >> Codes >> Servers Reboot Script
rem method 1: machines that are part of the domain
sc \\DOMINO01 stop "Lotus Domino Server (LotusDominoData)"
sleep 90
for /F "tokens=3 delims=: " %%H in ('sc \\DOMINO01 query "Lotus Domino Server (LotusDominoData)" ^| findstr " STATE"') do (
if /I "%%H" == "STOPPED" (
rem shutdown -r -m \\DOMINO01 -t 0
)
ELSE IF /I "%%H" == "RUNNING" (
sc \\DOMINO01 stop "Lotus Domino Server (LotusDominoData)"
sleep 120
rem shutdown -r -m \\DOMINO01 -t 0
)
)
sleep 300

rem method 2: machines that are not joined to domain
start psexec \\DOMINO01 -e -h -u DOMINO01\administrator -p PASSWORD net stop "Lotus Domino Server (DLotusDominodata)" && shutdown -r -m \\DOMINO01 -t 0

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post

BASH: Basic AWK Training

At first, AWK resembles the first three letter of 'awkward'. Nope, it's a scripting language…

Bash: How To Join Array With Comma Delimiter

# The following function joins an array of numbers # Limitation: the delimiter is expected…

Quick & Useful Snippet to Set SSL TLS Protocol of PowerShell

$requiredTls='Tls12' $availableSslProtocols=[enum]::getnames([net.securityprotocoltype]) if([Net.ServicePointManager]::SecurityProtocol -notin $requiredTls -and $requiredTls -in $availableSslProtocols){ [Net.ServicePointManager]::SecurityProtocol=[Net.SecurityProtocolType]::$requiredTls }