Forum Discussion

Mali_Stane's avatar
Mali_Stane
Copper Contributor
Aug 07, 2023

Powershell GUI Stop-AzVM , Get-AzVM, etc hangs

I’m trying to make simple GUI for my colleague, that can verify the status of the VM, start VM or Stop VM.

If I run command manually it works.

If i run  same command through PowerShell GUI , GUI window hangs. But result is as expected. So if  Coleg stop VM, VM is stop only GUI freeze indefinitely. I have waited  1h…. so freeze.

 

I have also try :

Start-Job -ScriptBlock {Stop-AzVM -ResourceGroupName $VarRG -Name $VarVM -NoWait -Force }

If I run this command manually in PowerShell command execute, job is also completed. An VM is stopped.

If I use same command in PowerShell Gui , Job complied successfully, but nothing happens to  VM. I also do not get any auth popup.

College start script with command :

Connect-AzAccount -Subscription  "abc**********"

Select-AzSubscription -SubscriptionId  "abc**********"

 

What would be a proper way to crate simple gui for this task. Yes I know  go to Azure, and do that there, od crat a workbook, or similar.