I am unsure if I am placing it in the correct location but am basing it off the wiki info. I currently have a Powershell script that is starting roughly 5 different jobs using the Start-Job cmdlet. Within the jobs I am using the Write-Log cmdlet and after a Wait-Job -Job $jobs I wait for all the jobs to be completed and then call Wait-Logging so the script looks something like this -
$jobs =@()
foreach($item in list){
$jobs += Start-Job -Name $item.Name -ScriptBlock { Write-Log -Message "This is from inside." }
}
Wait-Job -Job $jobs
Wait-Logging
Yet no log messages from inside the jobs actually get written to console or file. I have tried placing the Wait-Logging in a few different locations and nothing has changed.
Am I understanding the Wait-Logging cmdlet incorrectly?
edit:
After a bit more research it appears within the Start-Job process it doesn't contain the Write-Log cmdlet, I can try to figure that out on my own. However if I configure the logging targets outside of the job from within the job I have to re-specify the file, is there any way for the system to automatically detect to write to the file it has been writing to?
I am unsure if I am placing it in the correct location but am basing it off the wiki info. I currently have a Powershell script that is starting roughly 5 different jobs using the
Start-Job
cmdlet. Within the jobs I am using theWrite-Log
cmdlet and after aWait-Job -Job $jobs
I wait for all the jobs to be completed and then callWait-Logging
so the script looks something like this -Yet no log messages from inside the jobs actually get written to console or file. I have tried placing the Wait-Logging in a few different locations and nothing has changed.
Am I understanding the
Wait-Logging
cmdlet incorrectly?edit: After a bit more research it appears within the Start-Job process it doesn't contain the Write-Log cmdlet, I can try to figure that out on my own. However if I configure the logging targets outside of the job from within the job I have to re-specify the file, is there any way for the system to automatically detect to write to the file it has been writing to?