Function to restart process(es)
Utils\Restart-Process.ps1
Restart-Process [-Process] <Process>
Takes input via pipeline from Get-Process and restarts the process(es). If there is more than one instance of the same application: Then the function prompts to select the instance of the application to restart by index. An index of -1 stops all instances of the application and restarts the first.
#start 2 instances of notepad and restart the second
notepad
notepad
Get-Process notepad | Restart-Process
#enter index 2 when prompted
#start 3 instances of notepad restart the first and stop the others
notepad
notepad
notepad
Get-Process notepad | Restart-Process
#enter index -1 when prompted
#start notepad and calc and restart
Get-Process notepad,calc | Restart-Process
Process(es) to restart piped in via Get-Process
Type: Process
Parameter Sets: (All)
Aliases:
Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False