Hi, i am trying to figure out why when i invoke in parallel a script which export to a csv the computer inventory, i only get My computer data several times in every raw. Invoke-Parallel -ScriptFile .\WMI-inventory.ps1 -InputObject $(Get-Content .\target.txt) -ImportVariable s when executing there are no error on console... any idea? Mat
Hi I want to run new Parallel in Parallel how can I do this? The second Invoke-Parallel does not run. Code like: $TmpShutdownVMs = ... $VMMServer = ... $TmpHypervRebootTable = $ServersTable | Invoke-Parallel -ImportModules -Throttle 50 -RunspaceTimeou t 1800 -ErrorAction SilentlyContinu e { $Server = $_ $ServerName = $Server.ServerN ame $VMHost = Get-SCVMHost -ComputerName $ServerName $HypervVMs = Get-SCVirtualMa chine -VMMServer $Using:VMMServe r -VMHost $VMHost $PoweredOffVMs = $Using:TmpShutd ownVMs | Invoke-Parallel -ImportModules -Throttle 5 -RunspaceTimeou t 180 -ErrorAction SilentlyContinu e {...}
In Invoke-Parallel i am creating a new disk with a command New-AzureRmDisk, then it gives an error: Get-RunspaceDat a : The term 'New-AzureRmDis k' is not recognized as the name of a cmdlet, function, or script file....... code: $servers = 1..2 Invoke-Parallel -InputObject $servers -ScriptBlock { New-AzureRmDisk -Disk ............... .. } Please suggest me the solution for the same. Thanks and Regards Harsh
How we can use Invoke-Parallel to fetch ADUser data? I want to get all the users from AD and foreach user I want to fetch multiple properties parallel. Becasue ForEach process is taking time to get the details. sample dummy code. $users = Get-ADUser -Filter * ForEach($user in $users){ $SamName = $user.samaccountname $memberof = $user.memberof <More properties like above> }
I want to use this fix an issue I have with an Azure runbook I currently use for starting up to 50VMs each morning. How can I implement this as part of a runbook, can I import this somehow?
You can import the module going to the "Modules Gallery" menu, and importing the module WFTools that adds several cmdlet's including InvokeParallel . This was published by the same user. I use it this way: $VMs = Get-AzureRmVM -ResourceGroupName $RG $VMs | Invoke-Parallel -ImportVariable s -NoCloseOnTimeO ut -ScriptBlock { Start-AzureRMVM -ResourceGroup $_.ResourceGrou pName -Name $_.Name -Verbose }
I am building a script that will receive new input during execution (for example it may monitor a folder for new files) and perform some long process on each item. I want to use Invoke-Parallel or something similar, however I'm not sure how, or if, I can add items to the queue when it's already started. Lets say, for example, I have a folder with 100 .csv files in it, and I kick off invoke-parallel to process those 100 (5 at a time)... while it's running, 20 more files are added, is there any way to add those new 20 to the queue? Thanks!
I thinking about using invoke-Parallel to run scripts against AD. to sum it up, I doing a lot security filtering rights management in bulk. I'd hate to be the who brought the house down. Do you think it would be safe doing so?
Presumably, although you might want to somehow gate to a particular domain controller to avoid potential issues with replication. How would you go about this? You might also consider something less heavy-weight like ADSI, if that's possible, vs. having to load the AD module or Quest snapin, which can ding performance a bit.
Is there a way to access any of the count variables that are inside invoke-parallel? I want to rename files and append each with the iteration of the completed count. Cant seem to get it work by normal means so I thought maybe I could use what is already built in. Also tried to access a count variable using $parameter but no dice.
Hi, I am struggling to get this script working correctly. Hoping you could provide some advice. I wrote a script that deletes an azure vm then recreates it from a baseline VHD. I am invoking that script in parallel like so. [array]$VmInfo= @{vmName = "server1"; baseVHD = "Cool.vhd" } $VmInfo += @{vmName = "server2"; baseVHD = "Cooler.vhd" } $VmInfo | Invoke-Parallel -Quiet -ScriptBlock { c:\myscript.ps1 -vmName $_.vmName -baseVHD $_.baseVHD} This works whenever I run it from my machine but when I run it from a teamcity build step I get errors like this. It appears to run only one of the threads and not both. Get-RunspaceData : Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: indexAt C:\BuildAgent\w ork\92c00c526b3 78335\Modules\c ommon.psm1:1407 char:13 Get-RunspaceDat a -wait CategoryInfo : NotSpecified: (:) [Write-Error], ArgumentOutOfRa ngeExceptionFul lyQualifiedErro rId : System.Argument OutOfRangeExcep tion,Get-Runspa ceData *Note I put the invoke-parallel in as a module that gets loaded before executing. Am I doing this correctly? Any Idea whats going on?
Hi bigminer! Would you mind opening an issue on GitHub (https://github.com/RamblingCo okieMonster/Inv oke-Parallel/is sues)? It might be handy to see a sanitized version of your myscript.ps1 file - you can use code highlighting on github like so: ```powershell Some-Arbitrary -PowerShell Will-Show -Up Highlighted ``` Cheers!
HI, I am trying to use this script for shutting down all VMs simultaneously. There is one way of it i.e. Workflow. Since, Nano Server is not supporting Workflow execution, so I am stuck. I tried to pass a txt file as a Input object, which contains the name of the VMs, but it's not working. Any help on this highly appreciable.
I got the solution. I ran the workflow by using -PSComputerName from Remote server to Nano Server.