Ask your PowerShell-related questions, including questions on cmdlet development!
Forum rules Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 5 years and 1 month old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
because my listbox adds all time i clicked on search all unsers.
And i removed the row [array]$global:users += $Job | Receive-Job in the UpdateScript.
So i will try it now with the progress bar while starting the script. I will receive this post, if i get it works.
So i am back at this topic and hope i can solve my issue with you.
I would like to start a new session with New-PSSession but the loadtime is more than 20 seconds. So i would like to a an animated button in my script to show the user that the process is active. But how i can start a job with the following script:
If i execute this i can see the properties with $test = Receive-Job $job but locally i dont have any session. Is this possible or how can i show the user that the process is active?
jvierra wrote: ↑Thu Feb 21, 2019 7:10 am
What you are trying todo cannot be done. A job runs in a separate process and processes are isolated from each other.
Too bad. Is not it possible to indicate progress or otherwise in any other way while the code is running (as above)?
Currently only the button is disabled and no more.
You cannot create a session in a job. The session is unusable outside of the job nd no. there is no way to add a progress bar. When running "import-session" in a form (not a job) a progress bar will be automatically shown if it is required.
because my listbox adds all time i clicked on search all unsers.
And i removed the row [array]$global:users += $Job | Receive-Job in the UpdateScript.
So i will try it now with the progress bar while starting the script. I will receive this post, if i get it works.
I've get a problem with this part in my tool. The Problem is, that i got the ActiveDirectory module localy on my computer. If i deploy an executable file and run it on an other computer 'without the ActiveDirectory module' tells me powershell that the function Get-ADUser does not exist. I understand the problem that the module at program start only in the session remains and can not be passed to a background job. But is there a way to do a background job with its own / custom functions?
jvierra wrote: ↑Mon Feb 25, 2019 2:16 am
You have to have the module (RSAT) installed on any system that needs to use it. It cannot be passed to a remote system.
Is there no way to pass the Get-ADUser cmdlet on the job? Finally, the cmdlets are stored in a psm1 in the temp folder.
If it does not work, is there any way to permanently save the imported ActiveDirectory module as a module on the computer?
Copying a module to a machine that does not have RSAT installed will not work. When importing the module commands are modified to cause them to be executed through the remoting system. The module will not work locally. It will only work when remoting.
This topic is 5 years and 1 month old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.