Skip to content

Instantly share code, notes, and snippets.

View SQLtattoo's full-sized avatar

Vassilis Ioannidis - MTT [MSFT] SQLtattoo

View GitHub Profile
@SQLtattoo
SQLtattoo / get-vm-status-from-all-rgs.ps1
Created April 29, 2020 10:48
Get all VM status from all Resource Groups
function Get-AzureVMStatus
{
$RGs = Get-AzResourceGroup
foreach($RG in $RGs)
{
$VMs = Get-AzVM -ResourceGroupName $RG.ResourceGroupName
foreach($VM in $VMs)
{
$VMDetail = Get-AzVM -ResourceGroupName $RG.ResourceGroupName -Name $VM.Name -Status
$RGN = $VMDetail.ResourceGroupName
@SQLtattoo
SQLtattoo / nuke-a-module.ps1
Last active April 28, 2020 14:09
Remove all versions of a PowerShell module
# Make sure you understand that by running code it REMOVES ALL
# the versions of the specific module in this example of the
# module Az. No error handling.
# TAKE EXTRA CAUTION IF RUNNING ON PRODUCTION ENVIRONMENT!
$versions = Get-InstalledModule Az.* | Select-Object -Property Name,Version
$countmods = Get-InstalledModule Az.* | Measure-Object
Write-Host "Modules found: " $versions