Showing posts with label total. Show all posts
Showing posts with label total. Show all posts

Thursday, December 24, 2015

Powershell: VMware one liner to list total vm that are powered on each host

This one liner will query each host and id its cluster total vms and how many VMs are powered on
Get-VMHost | Select @{N="Cluster";E={Get-Cluster -VMHost $_}}, Name, @{N="Total_VMs";E={($_ | Get-VM).Count}},@{N="Powered_On";E={($_ | get-vm | ? {$_.powerstate -like "*ON*"}).count}} | Sort Cluster, Name | fl

Tuesday, January 22, 2013

Powershell Netapp - Total Volume size using get-navol


Purpose:
I needed a way to query a netapp filer to give all the volumes and their total size with snapshot reserve.This is my second powershell script so be easy on me :-) Also this requires dataontap powershell toolkit


              
param([string]$NetAppHost, [string]$username)

Import-module DataOnTap

$PathtoCSV = "C:\NetappTotalVolume.csv"

If ($NetAPPHost){$strNetAPPHost = $NetAPPHost}
ELSE{$strNetAPPHost = Read-Host "What is the Netapp hostname/IP?"}
If (!$strNetAPPHost){Write-Host "Error: Netapp hostname/ip not entered";exit}


If ($username){$strusername = $username}
ELSE{$strusername = Read-Host "What username?"}
If (!$strusername){Write-Host "Error: Username not entered";exit}

Connect-NAController $strNetAPPHost –cred $strusername

$allvolumesnames = get-navol | Select-Object Name,Available,TotalSize,snapshotpercentreserved

#set headers of CSV file
"Hostname,Available Space(GB),Used Space(GB),Total Volume Space(GB)" > $PathtoCSV
foreach ($netapp_vol in $allvolumesnames) {

$CurrentVolname = $netapp_vol.name
$VolumeSizeTotal = [math]::Round([decimal]((($netapp_vol.snapshotpercentreserved * 100) * $netapp_vol.TotalSize) + $netapp_vol.TotalSize)/1gb,2)
$VolumesAvailable =  [math]::Round([decimal]$netapp_vol.available/1gb,2)

#Create/add to CSV file
$Combine = $CurrentVolname,$VolumeAvailable1GB,$VolumeUsedSpace1GB,$VolumeSizeTotal1GB
$Combine -join "," >> $PathtoCSV
                 
    }               

Powershell: Microsoft Graph to add new roles to application registration

PowerShell Script Bulk add new roles to application registration in azure. Update $roles with ,Us...