To clarify:
To run Azure Cmdlets without blocking in a WinForm you must place all CmdLets in a Job.
$sb = { Your azure commands }
Start-Job -ScriptBlock $sb
Build you scriptblock and test at a command prompt before running it in the form.
Test the block alone first like this:
$sb.Invoke() or $sb.Invoke( arg1, arg2, …)
Then test as a job.
To get information from the job into the form use "Receive-Job"
When necessary use the "JobTracker" custom control set to do this.
GUI hang when specific script engine is chosen
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.
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.
- mxtrinidad
- Posts: 399
- Last visit: Tue May 16, 2023 6:52 am
Re: GUI hang when specific script engine is chosen
FYI...
In the code, I don't see where it is sent "as a job" to be run in the background. The "while" loop will not work as you probably need to do a Get-* to update the status property within the loop (and not outside).
Do you have this script working for the console? If not, I would suggest to create the console script first, and fine tune it before moving it to a GUI application.
The recent articles and blog post about background Jobs shows this method:
1. Create the console script first and make it work.
2. Then, with few more changes, move it to the GUI application.
Please feel free to post any questions, to get you going.
In the code, I don't see where it is sent "as a job" to be run in the background. The "while" loop will not work as you probably need to do a Get-* to update the status property within the loop (and not outside).
Do you have this script working for the console? If not, I would suggest to create the console script first, and fine tune it before moving it to a GUI application.
The recent articles and blog post about background Jobs shows this method:
1. Create the console script first and make it work.
2. Then, with few more changes, move it to the GUI application.
Please feel free to post any questions, to get you going.
- mxtrinidad
- Posts: 399
- Last visit: Tue May 16, 2023 6:52 am
Re: GUI hang when specific script engine is chosen
Also, I would suggest to post an issue on github Azure (https://github.com/Azure/azure-powershell/issues) asking when these cmdlets (Start/Get AzureStorageBlobCopy) are going to be included in AzureRM.
Keep in mind, everyone is moving away from Azure (Classic) Module.
Keep in mind, everyone is moving away from Azure (Classic) Module.