L8. Remoting, Jobs, and Scheduled Automation
Run work beyond your local shell with PowerShell remoting, background jobs, ForEach-Object -Parallel, scheduled tasks, and safe fan-out patterns.
Remoting Concepts
PowerShell remoting lets you run commands on other machines. On Windows, WinRM is common. PowerShell 7 also supports SSH-based remoting, which is useful across platforms.
Enter-PSSession -ComputerName server01
Invoke-Command -ComputerName server01 -ScriptBlock { Get-Service }In real environments, remoting depends on network reachability, authentication, authorization, host configuration, and logging. Do not treat it as just a command syntax problem.
Jobs
Jobs let work continue in the background:
$job = Start-Job -ScriptBlock { Get-Process | Sort-Object CPU -Descending | Select-Object -First 5 }
Receive-Job $job -Wait -AutoRemoveJobPowerShell 7 also supports parallel processing:
1..5 | ForEach-Object -Parallel {
"Worker $_ on $([Environment]::MachineName)"
} -ThrottleLimit 3Use throttling. Unlimited parallelism can overwhelm endpoints, APIs, or your own machine.
Scheduled Automation
For local Windows automation, scheduled tasks are still practical:
$action = New-ScheduledTaskAction -Execute 'pwsh.exe' -Argument '-File C:\Scripts\Inventory.ps1'
$trigger = New-ScheduledTaskTrigger -Daily -At 3am
Register-ScheduledTask -TaskName 'DailyInventory' -Action $action -Trigger $triggerIn cloud and DevOps environments, the same script may run under GitHub Actions, Azure Automation, or another runner. Keep scripts non-interactive, parameterized, logged, and idempotent.
Lab
- Start a local job that gathers process data.
- Receive the result and remove the job.
- Use
ForEach-Object -Parallelwith a throttle limit. - Draft a scheduled-task command for a daily inventory script.
- ✓PowerShell remoting can use WinRM or SSH depending on platform and configuration
- ✓Invoke-Command runs commands remotely; Enter-PSSession opens an interactive session
- ✓Start-Job runs background work and Receive-Job collects results
- ✓Use ThrottleLimit to avoid overwhelming systems during parallel execution
- ✓Scheduled automation should be non-interactive, parameterized, logged, and idempotent
1. Which command collects output from a background job?
2. Why is throttling important in parallel automation?
Recommended: Pluralsight
This free course covers the theory. Pluralsight adds structured video courses, hands-on Azure labs, and timed practice exams to make it stick before exam day.