Created
May 29, 2018 02:13
-
-
Save VibhuKuchhal/036658c0d014b7180c6cfe58c939544e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$terminal0 = New-PSSession Terminalmaster | |
$terminal1 = New-PSSession Terminal1 | |
$terminal2 = New-PSSession Terminal2 | |
$terminal3 = New-PSSession Terminal3 | |
$terminal4 = New-PSSession Terminal4 | |
$terminal5 = New-PSSession Terminal5 | |
function Disable-MigrationTasks{ | |
Invoke-Command -session $terminal0 -script { Get-ScheduledTask -TaskName "Migration GetMigrationTasks" | Disable-ScheduledTask } | select PSComputerName, state | |
Invoke-Command -session $terminal0 -script { Get-ScheduledTask -TaskName "Migration Mail Automation" | Disable-ScheduledTask } | select PSComputerName, state | |
Invoke-Command -session $terminal1 -script { Get-ScheduledTask -TaskName "MigrationTerminalTask" | Disable-ScheduledTask } | select PSComputerName, state | |
Invoke-Command -session $terminal2 -script { Get-ScheduledTask -TaskName "MigrationTerminalTask" | Disable-ScheduledTask } | select PSComputerName, state | |
Invoke-Command -session $terminal3 -script { Get-ScheduledTask -TaskName "MigrationTerminalTask" | Disable-ScheduledTask } | select PSComputerName, state | |
Invoke-Command -session $terminal4 -script { Get-ScheduledTask -TaskName "MigrationTerminalTask" | Disable-ScheduledTask } | select PSComputerName, state | |
Invoke-Command -session $terminal5 -script { Get-ScheduledTask -TaskName "MigrationTerminalTask" | Disable-ScheduledTask } | select PSComputerName, state | |
} | |
function Enable-MigrationTasks{ | |
Invoke-Command -session $terminal0 -script { Get-ScheduledTask -TaskName "Migration GetMigrationTasks" | Enable-ScheduledTask } | select PSComputerName, state | |
Invoke-Command -session $terminal0 -script { Get-ScheduledTask -TaskName "Migration Mail Automation" | Enable-ScheduledTask } | select PSComputerName, state | |
Invoke-Command -session $terminal1 -script { Get-ScheduledTask -TaskName "MigrationTerminalTask" | Enable-ScheduledTask } | select PSComputerName, state | |
Invoke-Command -session $terminal2 -script { Get-ScheduledTask -TaskName "MigrationTerminalTask" | Enable-ScheduledTask } | select PSComputerName, state | |
Invoke-Command -session $terminal3 -script { Get-ScheduledTask -TaskName "MigrationTerminalTask" | Enable-ScheduledTask } | select PSComputerName, state | |
Invoke-Command -session $terminal4 -script { Get-ScheduledTask -TaskName "MigrationTerminalTask" | Enable-ScheduledTask } | select PSComputerName, state | |
Invoke-Command -session $terminal5 -script { Get-ScheduledTask -TaskName "MigrationTerminalTask" | Enable-ScheduledTask } | select PSComputerName, state | |
GetStatus-MigrationTasks | |
} | |
function GetStatus-MigrationTasks{ | |
Invoke-Command -session $terminal0 -script { Get-ScheduledTask -TaskName "Migration GetMigrationTasks" | Select taskname, state } | |
Invoke-Command -session $terminal0 -script { Get-ScheduledTask -TaskName "Migration Mail Automation" | Select taskname, state } | |
Invoke-Command -session $terminal1 -script { Get-ScheduledTask -TaskName "MigrationTerminalTask" | Select taskname, state } | |
Invoke-Command -session $terminal2 -script { Get-ScheduledTask -TaskName "MigrationTerminalTask" | Select taskname, state } | |
Invoke-Command -session $terminal3 -script { Get-ScheduledTask -TaskName "MigrationTerminalTask" | Select taskname, state } | |
Invoke-Command -session $terminal4 -script { Get-ScheduledTask -TaskName "MigrationTerminalTask" | Select taskname, state } | |
Invoke-Command -session $terminal5 -script { Get-ScheduledTask -TaskName "MigrationTerminalTask" | Select taskname, state } | |
} | |
function Start-MigrationTasks{ | |
Invoke-Command -session $terminal0 -script { Get-ScheduledTask -TaskName "Migration GetMigrationTasks" | Start-ScheduledTask } | |
Invoke-Command -session $terminal0 -script { Get-ScheduledTask -TaskName "Migration Mail Automation" | Start-ScheduledTask } | |
Invoke-Command -session $terminal1 -script { Get-ScheduledTask -TaskName "MigrationTerminalTask" | Start-ScheduledTask } | |
Invoke-Command -session $terminal2 -script { Get-ScheduledTask -TaskName "MigrationTerminalTask" | Start-ScheduledTask } | |
Invoke-Command -session $terminal3 -script { Get-ScheduledTask -TaskName "MigrationTerminalTask" | Start-ScheduledTask } | |
Invoke-Command -session $terminal4 -script { Get-ScheduledTask -TaskName "MigrationTerminalTask" | Start-ScheduledTask } | |
Invoke-Command -session $terminal5 -script { Get-ScheduledTask -TaskName "MigrationTerminalTask" | Start-ScheduledTask } | |
} | |
function Stop-MigrationTasks{ | |
Invoke-Command -session $terminal0 -script { Get-ScheduledTask -TaskName "Migration GetMigrationTasks" | Stop-ScheduledTask } | |
Invoke-Command -session $terminal0 -script { Get-ScheduledTask -TaskName "Migration Mail Automation" | Stop-ScheduledTask } | |
Invoke-Command -session $terminal1 -script { Get-ScheduledTask -TaskName "MigrationTerminalTask" | Stop-ScheduledTask } | |
Invoke-Command -session $terminal2 -script { Get-ScheduledTask -TaskName "MigrationTerminalTask" | Stop-ScheduledTask } | |
Invoke-Command -session $terminal3 -script { Get-ScheduledTask -TaskName "MigrationTerminalTask" | Stop-ScheduledTask } | |
Invoke-Command -session $terminal4 -script { Get-ScheduledTask -TaskName "MigrationTerminalTask" | Stop-ScheduledTask } | |
Invoke-Command -session $terminal5 -script { Get-ScheduledTask -TaskName "MigrationTerminalTask" | Stop-ScheduledTask } | |
} | |
<# | |
Enable-MigrationTasks | |
Start-MigrationTasks | |
Start-Sleep 120 | |
Stop-MigrationTasks | |
Disable-MigrationTasks | |
#> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment