levi
Junior Member
Posts: 57
|
Post by levi on Jun 18, 2019 23:34:05 GMT
I am working to build out a user state swap tool using UI++ as the front end, and a PowerShell script for the heavy lifting. I have a few questions.
1) When using External call - My PowerShell script it does not wait for the script to finish running. I need it to wait until the it actually finishes running. Any ideas?
+ Running external command: PowerShell.exe -ExecutionPolicy Bypass -File .\swap.ps1 -NoExit. Maximum run time for this command is 60 seconds. UI++ 6/18/2019 4:28:40 PM 4384 (0x1120)
+ External command execution completed with exit code: 0. UI++ 6/18/2019 4:28:42 PM 4384 (0x1120)
2) I am not running this in a task sequence, so what is the best way to pass variables back if I cannot use the TSEnvironment COM object, how do I pass it back?
|
|
|
Post by Jason on Jul 1, 2019 21:59:01 GMT
Hi Levi,
The action waits on the exit of the called process (up to the default of 60 seconds) but it doesn't look like you are hitting that limit. What does the script do? Does it call some other process and then exit?
Also, a side question here: Is it your intent to pass -NoExit to the swap.ps1 script? If not, then you need to move -NoExit before the -File option although I'm not sure why'd you want to do that here.
|
|
levi
Junior Member
Posts: 57
|
Post by levi on Jul 1, 2019 22:23:44 GMT
It must be my script, I just tried it with a Test.ps1 (only line: Sleep -Seconds 120) and it waited the 60 seconds and exited. Is it possible to specify a value to wait indefinitely? In my case running USMT could take hours. Do you have any suggestions on #2 above, how to pass values back to UI++ when it is run outside a Task Sequence?
|
|
|
Post by Jason on Jul 4, 2019 21:29:44 GMT
If you use 0xFFFFFFFF as the timeout value, it should wait forever as that's the behavior of the underlying API. I don't really suggest this though and instead, suggest something large but finite.
|
|
john
New Member
Posts: 1
|
Post by john on Sept 24, 2019 13:20:37 GMT
Jason, I'm also interested if there is any method to pass values from external calls back to UI++ when it is run outside of a task sequence. Is this possible?
|
|
|
Post by Jason on Oct 2, 2019 1:22:35 GMT
There's nothing direct, but there are multiple ways to do this. UI++ can read values from the registry, WMI, and a file. It can also directly reference environment variables. Thus, if called your external process stores the values it wishes to return to UI++ in one of these, the UI++ can read them from there.
|
|