E14– Windows Server Backup on DAG–Part2– Redistribute Active Database before WSB

 

1. on MBX01 – Run the batch on week day 1,3,5

image_thumb[7]

echo off

For /f "tokens=1-3 delims=/ " %%a in ('date /t') do (set date=%%a-%%b-%%c)
For /f "tokens=1-2 delims=: " %%a in ('time /t') do (set time=%%a:%%b)


rem echo The date is %date%
rem echo The time is %time%

Rem ==================================
PowerShell.exe -command ". C:\Batch\WSB\PS_RedistributeActiveDatabase_before-WSB.ps1"

Rem ==================================
Cscript C:\Batch\WSB\DB_Active_Notify.vbs

Rem ==================================
del  "C:\Batch\WSB\DB_Activation_Log\DB_Activation.txt"

Timeout /T 100

Rem ==================================
Rem ==================================
set backuplog="c:\batch\WSB\BackupLog\"%computername%-WSB.txt""

echo. Start:%date%  %time%  >> %backuplog%
echo. ================================== >> %backuplog%

Rem ==================================

rem pause
wbadmin start backup  -backupTarget:B: -include:P:,S:,T:,U:,V:,W:  -vssFull -quiet >> %backuplog%

Rem ==================================
echo. ================================== >> %backuplog%

For /f "tokens=1-3 delims=/ " %%a in ('date /t') do (set date=%%a-%%b-%%c)
For /f "tokens=1-2 delims=: " %%a in ('time /t') do (set time=%%a:%%b)

echo. Start:%date%  %time%  >> %backuplog%
echo. ================================== >> %backuplog%


Rem ==================================
cscript C:\Batch\WSB\Backupnotify.vbs

Rem ==================================
copy "c:\batch\WSB\BackupLog\"%computername%-WSB.txt"" "c:\batch\WSB\BackupLog\"%computername%-WSB_%date%.txt"" /Y
del  "c:\batch\WSB\BackupLog\"%computername%-WSB.txt""

 

2. Echo Time

echo off

For /f "tokens=1-3 delims=/ " %%a in ('date /t') do (set date=%%a-%%b-%%c)
For /f "tokens=1-2 delims=: " %%a in ('time /t') do (set time=%%a:%%b)


rem echo The date is %date%
rem echo The time is %time%

 

3. Run PS_RedistributeActiveDatabase_Before-WSB.ps1

PowerShell.exe -command ". C:\Batch\WSB\PS_RedistributeActiveDatabase_before-WSB.ps1"

Rem ==================================
PowerShell.exe -command ". C:\Batch\WSB\PS_RedistributeActiveDatabase_before-WSB.ps1"

 

4.  PS_RedistributeActiveDatabase_before-WSB.ps1"

image

 

5.
image

D:\Exchsrvr\Scripts\.\RedistributeActiveDatabases.ps1 -ShowDatabaseDistributionByServer | ft -autosize >>"C:\Batch\WSB\DB_Activation_Log\DB_Activation.txt"

Move-ActiveMailboxDatabase -Server BQT-MBX01 -ActivateOnServer BQT-MBX02 -Confirm:$false

D:\Exchsrvr\Scripts\.\RedistributeActiveDatabases.ps1 -ShowDatabaseDistributionByServer | ft -autosize >>"C:\Batch\WSB\DB_Activation_Log\DB_Activation.txt"

 

6.

D:\Exchsrvr\Scripts\.\RedistributeActiveDatabases.ps1 -ShowDatabaseDistributionByServer | ft -autosize >>"C:\Batch\WSB\DB_Activation_Log\DB_Activation.txt"

image

image

 

7.

Move-ActiveMailboxDatabase -Server BQT-MBX01 -ActivateOnServer BQT-MBX02 -Confirm:$false



8.

D:\Exchsrvr\Scripts\.\RedistributeActiveDatabases.ps1 -ShowDatabaseDistributionByServer | ft -autosize >>"C:\Batch\WSB\DB_Activation_Log\DB_Activation.txt"

image

Comments

Popular posts from this blog

E15 CU3–Update Failed–AD replicated Exceeded the tombstone lifetime.

202301 - Exchange onpreme - PowerShell Serialization Payload Signing

E14–Bulk Create Mail Contact & Set-Contact