Questions tagged [powershell-jobs]

The facility described in about_Jobs, PowerShell background jobs.

YOU WILL NOT BE PAID.

43 questions
0
votes
0 answers

Powershell query. New sessions cause workflow to be cloned?

tl;dr Entering a new powershell session seems to create (or reveal) a copy PSWorkflowJob. Explain? As seen in the elevated code below, I create a simple Workflow and run it as a job. While it is suspended, I enter into a new PS session and the…
xenull
  • 83
  • 1
  • 6
0
votes
1 answer

Powershell - how to get Location of job with job result in one table?

I want to get serial numbers of remote PC's with the name of PC, in one table. $PCNameArray is array of remote PC I want to get serial numbers. $complete = $false $arrayJobs = @() Foreach($a in $PCNameArray) { $arrayJobs += Get-WmiObject…
Ruslannnn
  • 5
  • 1
0
votes
0 answers

How to get a -job output data concurrently without freezing the gui?

I have a script block that when I press a button in a window it gets me the output data back in to a textbox but the issue is that it only gives me the last lines in the output, my question is how can I get the output text concurrently without…
Jay Ross
  • 1
  • 1
  • 1
0
votes
0 answers

Is there a way to make a powershell job accessable from other powershell windows for the same user?

Say I run a powershell job as a user in one window, and then want to retrieve the results in another powershell window; Is it possible to make it global somehow, so I can pull it up on another machine? I imagine the answer I'm going to get is…
leeand00
  • 25,510
  • 39
  • 140
  • 297
0
votes
1 answer

How to pass MFA enabled Azure account credentials into PowerShell ScriptBlock?

connect-azuread | out-null $global:token = [Microsoft.Open.Azure.AD.CommonLibrary.AzureSession]::AccessTokens $ceo = "" Import-Csv "C:\Users\abhilash\Music\users.txt" | ForEach-Object { $scriptblock =…
0
votes
0 answers

Powershell - Running New-PSSession multiple times causes error

I am trying to run a fairly simple command on 20 servers in parallel. What I have so far is this : $servers = @() $servers = ( "server1", "server2", "server3", "server4", "server5", …
evolmonster
  • 237
  • 1
  • 5
  • 16
0
votes
0 answers

Want to use multi-thread with powershell job to run separate windows form because show dialogue freeze parent form

I tried to build an application with windows form with Powershell, I encountered a problem, When i run my parent form, i have no problem, i can open a child form but when my child form is open, i can't go back to my parent form, i search on internet…
0
votes
0 answers

Powershell Job Active Directory Timeout

I am creating a script which checks for disabled user. To shorten the time it takes to find the information for each user I wanted to create jobs which do this in parallel. Put only the first job actually finishes, all other jobs timeout with this…
0
votes
1 answer

PowerShell implementing -AsJob for a cmdlet

Is there a nice way to implement the switch parameter -AsJob in custom cmdlets, like Invoke-Command has? The only way I thought about this is: function Use-AsJob { [CmdletBinding()] [OutputType()] param ( [Parameter(Mandatory =…
Garbem
  • 149
  • 1
  • 13
0
votes
1 answer

Copy-Item from USB Does Not Work as a Job

I'm copying files to a USB utilizing the path of the USB (assuming one drive plugged in) rather than the drive letter. I need to do it this way since I'm using this to clone 52 USBs at once. This is where the prefix for the path is found: $usb =…
Doug
  • 6,446
  • 9
  • 74
  • 107
0
votes
1 answer

Powershell jobs and Set-AzureRmRouteTable

I keep getting this error when I use this cmdlet in my script block Cannot parse the request. StatusCode: 400 ReasonPhrase: Bad Request OperationID : '2410b534-3ab9-4c82-b0fa-233e5a36e795' + CategoryInfo : CloseError: (:)…
meow tho
  • 37
  • 1
  • 1
  • 6
0
votes
1 answer

not getting output from receive job

The variable $var is blank when I run this script: function FOO { write-output "HEY" } $var = Start-Job -ScriptBlock { ${function:FOO} } | Wait-Job | Receive-Job $var How do I get output from receive-job?
red888
  • 27,709
  • 55
  • 204
  • 392
-1
votes
1 answer

Powershell: Search for word in file and change it, if the file exists

In the company I work for, we wanted to change a timer to an .ini file for around 310 computers, in order to extend this timer. So I searched around and did find some scripts, but they were not doing exactly what we wanted. So i sat down googled…
1 2
3