---
title: "Discussion on \"Quick Script to Switch Azure VM on/off\" | Hashnode"
description: "Discussion on \"Quick Script to Switch Azure VM on/off\". $ResourceGroupName = \"$(yourpipelinevariable)\"\n\n$Vmname = \"$(yourpipelinevariable)\"\n\n$VMstatus = Get-AzVm -ResourceGroupName $ResourceGroupName -name $Vmname -Status\n\nif ($VMstatus.Statuses[1].code -eq \"powerstate/deallocated\") {\n\n    $newVMstatus = ..."
url: "https://hashnode.com/posts/quick-script-to-switch-azure-vm-onoff/65ccf73fd35d8146099bd0a9"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Quick Script to Switch Azure VM on/off](https://taherkhan.hashnode.dev/quick-script-to-switch-azure-vm-onoff?utm_source=hashnode&utm_medium=feed)

$ResourceGroupName = "$(yourpipelinevariable)" $Vmname = "$(yourpipelinevariable)" $VMstatus = Get-AzVm -ResourceGroupName $ResourceGroupName -name $Vmname -Status if ($VMstatus.Statuses\[1\].code -eq "powerstate/deallocated") { $newVMstatus = ...

Feb 14, 2024 · 1 min read · taherkhan.hashnode.dev  
Read the article

## Written by

[Taher Khan](https://hashnode.com/@TaherKhan)

@TaherKhan · London, UK

  
[View profile](https://hashnode.com/@TaherKhan)

All things Azure Cloud Engineering

I am an Azure Cloud Engineer from London. I enjoy learning and sharing knowledge about my Cloud Journey.

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
