Product, version and build: 2015 4.2.95.0
32 or 64 bit version of product: 64
Operating system: Windows 2008 R2
32 or 64 bit OS: 64
Another tricky one. I want to execute a function that may take 30 seconds or so using the JobTracker so that it doesn't block the UI.
However, I often want to to this on a remote machine. Is it possible to use the Jobtracker to run the function in a remote PSSession and have it return the results?
I'm having trouble getting it to pass a PSSession object to the JobScript as a parameter as it appears to deserialize the session object
ERROR: Cannot bind parameter 'Session'. Cannot convert the "[PSSession]Session1" value of type "Deserialized.System.Management.Automation.Runspaces.PSSession" to
ERROR: type "System.Management.Automation.Runspaces.PSSession".
ERROR: + CategoryInfo : InvalidArgument: (:) [Invoke-Command], ParameterBindingException
ERROR: + FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Microsoft.PowerShell.Commands.InvokeCommandCommand
ERROR: + PSComputerName : localhost
ERROR:
Edit: Found a post from 2013 about the same thing.
https://social.technet.microsoft.com/Fo ... powershell
Looks like I need to use Runspaces. Whoah...that's getting pretty advanced now for a small little application!
Any chance this functionality can be introduced a future version?
Add-JobTracker with a PSSession
Forum rules
DO NOT POST LICENSE NUMBERS, ACTIVATION KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
DO NOT POST LICENSE NUMBERS, ACTIVATION KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Re: Add-JobTracker with a PSSession
I will add a request to the wish list.
Have you tried creating the Runspace in the Job? Use Invoke instead of BeginInvoke so that it executes synchronously and you don't have to create a wait loop.
David
Have you tried creating the Runspace in the Job? Use Invoke instead of BeginInvoke so that it executes synchronously and you don't have to create a wait loop.
David
David
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.
Re: Add-JobTracker with a PSSession
I hadn't tried that but I found another way of doing what I needed to do
Thanks anyway
Thanks anyway