Shutdown Azure VM, only when no one is using it.

Hello Everyone,

I have scheduled the Start/Shutdown of VM through Azure Automation.Everything works fine.But, When user logged in to the machine and doing some work in the scheduled shutdown time,still it force the VM to shutdown.Is there any way I can tell the script to Shutdown the VM only when no one is connected/using?I have searched for it, but I am unable to get it.

When I run Get-AzureVM. It provides other information not the one I am looking for.

Thanks.

No, there isn’t really a native way to do that. Azure kind of assumes that machines are “doing work” all the time, even if (as with a server) a user isn’t logged in. The most you could probably do is hack together a logon/logoff script. The logon script disables the shutdown, the logoff script re-enables it. But that’s going to be unreliable in some instances.