I am using a PowerShell module called Logging. I use other Jobs to do some work, but unforunately the logs that I write in them are not received by the command Receive-Job.
function Get-Topic {
[CmdletBinding(DefaultParameterSetName =…
I am trying to write data to external array while running a powershell job-
This is my code sample that I' m trying-
$datafromJob = @()
$wmijobs = @()
foreach ($c in $computers) {
$wmijobs += Start-Job -Name WMIInventory -ScriptBlock {
…
I want to run 15 instances of a script that pipelines 5 scripts together, and so far I'm missing the pixie dust. I've boiled the problem down to a test case with a master script that calls a slave script that in turn calls a sub_slave script (no…
I want to write script that enables mail forwarding for some user on exchange server and turn it off at specified time.
But when $script_bloc executes in job: New-PSSession returns null without any error.
I can pass to New-PSSession hardcoded…
I'm starting a PowerShell job with something like the following command:
start-job -filename my_script.ps1 -argumentlist ($v1, $v2, $v3)
This script, however needs to know where it's located, because it runs other commands based on their location…
I'm trying to get a simple working example of using functions inside of jobs. I've managed to pass my function into the scriptblock used for my job, but I can't seem to get parameters to the function.
# concurrency
$Logx =
{
param(
…
I am trying to understand how Receive-Job works internally. In below code I can see where Job object keeps records from different steams:
$InformationPreference = 'SilentlyContinue'
$sb = {
$VerbosePreference = 'Continue'
…
Jason Archer helped me solve my last issue, but in testing his solution I stumbled across the real problem. My server won't run chained background jobs correctly, but my laptops will.
If I run the scripts in the previous problem on my laptops, they…
Related to Terminate part of powershell script and continue.
Partially related to Powershell Job Always Shows Complete.
My script runs locally and access the registry hive of a remote PC. I need the value of registry keys to be written into a…
Currently I am trying to get an output of all disabled users and their message counts in exchange. This is easy enough through a foreach loop:
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri…
I have to call a long running workflow from another workflow asynchronously. Is there a way to do that in powershell?
workflow CalledWorkflow
{
Start-Sleep -s 100;
}
workflow CallingWorkflow
{
CalledWorkflow
"CalledWorkFlow Invoked"
}
Now…
I want to launch a long-running remote program but don't want to wait. So I put below one line command in PS script file and run "Powershell -file xxx.ps1"
Invoke-command server1 {xxx.exe} -AsJob
But the remote program is not running after the…
I need to get some procs by the owner. My demo script below will first look for procs by owner locally, then it will do the same thing, but it invokes the command on the same box:
cls
write-host 'LOCAL CALL: '
$procs = @(Get-WmiObject win32_process…
I'm trying to get a better understanding of how powershell handles jobs.
Both of these article posts helped a lot:
Multi-Threading in powershell
Pass array to Start-Job
However, with the following sample script, I am getting unexpected results…