Skip to content

Instantly share code, notes, and snippets.

@chgeuer
Created July 1, 2012 13:40
Show Gist options
  • Select an option

  • Save chgeuer/3028452 to your computer and use it in GitHub Desktop.

Select an option

Save chgeuer/3028452 to your computer and use it in GitHub Desktop.

Git & PowerShell

Markdown Editors

PowerShell

How to load the Powershelll Azure commandlets

Import-Module 'C:\Program Files (x86)\Microsoft SDKs\Windows Azure\PowerShell\Microsoft.WindowsAzure.Management.psd1'

How to see a list of commands

Get-Command -Module Microsoft.WindowsAzure.Management | select name

How to save all VM metadata in local XML files, and kill the machines

$serviceName = 'chgeuerlinux'

Get-AzureVM -ServiceName $serviceName | foreach { 
    $path = 'c:\vms\' + $_.Name + '.xml'
    Export-AzureVM -ServiceName $serviceName -Name $_.Name -Path $path
}

Remove-AzureDeployment -ServiceName $serviceName -Slot Production -Force

Further links

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment