Currently have around 50 URL's which we need to periodically view randomly on a wall mounted TV in work along with 6 URL's which must always be up and available. Plan is to choose a random URL from the list of 50 and display it for 30 seconds in Firefox, then kill the process and choose another URL to automatically open in its predecessors place, but always maintaining the other 6 Firefox instances in the background. Problem I am having is that the PowerShell code shows the PID of the new Firefox instance but the PID is not present in Task Manager so does not close, and we end up with too many pages open. No idea how to resolve this, any ideas welcome, though a Powershell related resolution would be preferred.
Tab rotator would not work as we had way too many tabs open. Tried implementing a time based script so any Firefox instance over 30 seconds but less than 1 minute would be killed, however this always seemed to kill all Firefox instanced including the 6 which must always be available.
Part of the PowerShell code is below:
$bb = 1
$app = Get-Content $importPath |
Get-Random -Count $bb |
ForEach-Object {Start-Process -PassThru $_}
Wait-Process $app.Id
Write-Host $app.Id
Start-Sleep -Seconds 30
Stop-Process $app
Current script shows me the PID from 'Write-Host $app.Id' in ISE however, that PID is not present in Task Manager, so wondering if this is a Firefox related issue as oppose to POSH. Expected outcome would be that PS kills the explicit PID and a new random URL is spawned in Firefox.