Morning All,
I was wondering if you could help me on a script I am writing?
My runbook is planning to run on a schedule and manually shutdown/power on environments as per their tags. I have a tag called 'DowntimeHours' and a schedule. So far, I have it working nicely for virtual machines. A key step is to check the current power status by using:
get-azurermvm -status
That gives me a heading for 'PowerState'. With that information, I can add it to an if statement to determine which action is required. Works beautifully.
Now, this is where the fun starts... I want to be able to do the same for Scale Set instances, where I can stop/unallocate all but one node when the schedule matches.
To close down the instance is easy, I can simply fun:
stop-azurermvmss -instanceid
No matter where I look, I cannot find a way to determine the current powerstatus by using powershell. Is there something available?
There must be an api exposing this, as I can see it within the Azure Portal.
Thanks in advance,
Paul
Kind Regards, Paul Sanders | MCSE PC | MCITP EA, VA | MCTS SCCM/SCOM | My Blog: http://tameyourcloud.com