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: Office 365 Bulk Licensing, Changing IDs, Enabling POP3

Connect to Office 365 # Office 365 Global Admin Credential$username="O365globalAdmin"$password=ConvertTo-securestring "PASSWORDHERE" -AsPlainText -Force$cred = New-Object…

WordPress: Add Search Box Into Header

Navigate to Appearance > Theme Editor > select header.php > search for this section: <div…

PowerShell: Take VM Snapshots

# takeVmSnapshot.ps1 $vmNames='Test-VM1','Cowabunga-VM4' $snapShotLabel="Snapshot $(get-date -Format yyyyMMddTHHmmss)" function takeVmSnapshot([string[]]$vmName,[string]$snapshotLabel){ $vmClusterNodes=Get-ClusterGroup|?{$_.GroupType -eq 'VirtualMachine'} foreach ($vm in…