Comments (4)
Alrighty! This was added in #46. You can now use -ImportFunctions
Now that I think about it... there might be some oddities for functions defined in modules - will have to revisit that.
Cheers!
from invoke-parallel.
Hi Brad!
Invoke-Parallel won't pull in function definitions - as a workaround, if you import the module or load up the functions inside the Invoke-Parallel scriptblock, it should work.
I'll look at adding a parameter to allow including functions from the current PowerShell session, but might take a bit of time.
I still use Invoke-Parallel for a number of ad-hoc tasks and scripts, but do check out @proxb's PoshRSJob; it includes this functionality already, if I recall correctly.
Thanks!
Warren
from invoke-parallel.
I'll look at adding a parameter to allow including functions from the current PowerShell session, but might take a bit of time.
That would be great - thanks.
My reservation with using a PS module is portability of the script. I'd like to keep the code all self contained in one folder so that migrating it to a new server is as simple as copying the script folder.
Having the extra step of having to install a custom module isn't the end of the world but also not ideal either - particularly if a future maintainer isn't familiar with the script.
The reason for trying to use Invoke-Parallel is that I need to kick off a number of backjob jobs (as you may have guessed from my function names) but I also need transcription (powershell logging).
I was attempting to use the powershell start-job native function but I guess that doesn't support transcription when running jobs. :(
Would invoke-parallel support powershell transcripts if i created a POSH module with my custom functions? Any idea if PoshRSJob does either?
Thanks,
Brad
from invoke-parallel.
Hi, I am trying to use this function to call my custom function in parallel, but it fails..
1: I am not able to pass multiple input parameters to my custom function
2. Custom Function doesnt respond correctly when invoke using this function
Invoke-Parallel -ScriptBlock { Get-vspherevmname -vmname $_.NAME -org "12345" -vapp "12345"} -InputObject $vm -ImportFunctions
Below is how i call the function individually and using invoke-parallel
PS C:\Users\e554> Get-vspherevmname -vmname $vmv[0].Name -org $org.Name -vapp $Vappp.Name
output: R511-SRVA-WyU3
PS C:\Users\e554> $bab = Invoke-Parallel -ScriptBlock { Get-vspherevmname -vmname $_.NAME -org "ID14434-1-1231231" -vapp "12345"} -InputObject $vmv -ImportFunctions
Output:Catch Block
Can you please help
from invoke-parallel.
Related Issues (20)
- NullReferenceException HOT 1
- Physical Memory usage HOT 2
- Log file locks if multiple scripts invoke-parallel HOT 4
- Get-RunspaceData error: Collection was modified; enumeration operation may not execute HOT 1
- it is not working to get AD group member using Get-ADGroupMember HOT 1
- Get-RunspaceData : ERROR: Deployment failed HOT 2
- Invoke-Parallel: When launched within a function, does not carry param()-variables forward
- Invoke-Parallel Scriptblock [Enviornment]::GetEnvironmentVariable
- Using a shared & synchronized variable to hold a counter HOT 2
- How we can use Invoke-Parallel to fetch ADUser data? HOT 4
- Import-Modules in parallel when session profile loaded? HOT 1
- Issue with Get-WMIObject HOT 1
- Weird error running Invoke-Parallel
- Variable Creep HOT 3
- Adding item to external collection HOT 2
- Error A null key is not allowed in a hash literal HOT 1
- skips
- Invoke-Parallel skips processing some objects when throttle > 1 HOT 2
- Fast-Ping Sweep (recommendations or tricks) HOT 2
- $PWD inside the script block doesn't update after changing the current directory
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from invoke-parallel.