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

PowerShell: Hobocopy Backup Software

# hobocopy-backup.ps1# Note: this is a quick snippet to demonstrate the use of this utility.#…

SQL Failover (Simple Method)

$servers="SQL01","SQL02","SQL03"; # Dynamic Credential method 1 $who = whoami if ($who.substring($who.length-2, 2) -eq "-admin"){$username=$who;} else…

PowerShell: Get ‘Size on Disk’ of Files in Windows

There are many methods of attempting to obtain "size on disk" values of files in…