locked
Powershell Background Jobs RRS feed

  • Question

  • Good Morning all, 
    Wanted to ask question in regards to Powershell Background Jobs. Specifically if it is possible to initiate a background job within one remote session (say for example on a server). And then access that same job by logging onto that server (either through get-job or some other method). 

    The idea is that one process will create jobs to copy large files to an archive area. Those jobs will remain running on the remote server, and can (hopefully) be monitored remotely on another server. Is something like this possible, or when using start-job does that depend on the parent session that initiated the request?

    Thanks in advance

    Friday, September 29, 2017 10:29 AM

Answers

  • You can create remote jobs and monitor them remotely.  A scheduled job is a PowerShell script/block that runs in the background and can be monitored with Get-Job.  It runs even when PS is not running.

    help Register-ScheduledJob -full

    You can also crate a remote session and disconnect from it.  The session can be polled for its results.

    https://4sysops.com/archives/powershell-disconnected-remote-sessions/


    \_(ツ)_/

    • Marked as answer by Satbir Bussan Friday, September 29, 2017 2:32 PM
    Friday, September 29, 2017 10:42 AM

All replies

  • You can create remote jobs and monitor them remotely.  A scheduled job is a PowerShell script/block that runs in the background and can be monitored with Get-Job.  It runs even when PS is not running.

    help Register-ScheduledJob -full

    You can also crate a remote session and disconnect from it.  The session can be polled for its results.

    https://4sysops.com/archives/powershell-disconnected-remote-sessions/


    \_(ツ)_/

    • Marked as answer by Satbir Bussan Friday, September 29, 2017 2:32 PM
    Friday, September 29, 2017 10:42 AM
  • Good Afternoon JRV, 
    Many thanks for your assistance. This does indeed help. Will try out a few commands and observe the results. Thanks again 
    Friday, September 29, 2017 2:32 PM