Skip to content

Commit

Permalink
Added a new PowerShell module for SCVMM
Browse files Browse the repository at this point in the history
  • Loading branch information
DeploymentBunny committed Nov 25, 2016
1 parent d988ab9 commit d2a41fb
Showing 1 changed file with 60 additions and 0 deletions.
60 changes: 60 additions & 0 deletions Tools/Get-VIASCVMDiskInfo/GetVIASCVMDiskInfo.psm1
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
Function Get-VIASCVMDiskInfo{
<#
.Synopsis
Get-VIASCVMDiskInfo is a function that gets virtual harddisks from SCVMM.
.DESCRIPTION
Get-VIASCVMDiskInfo is a function that gets virtual harddisks from SCVMM.
It presents:
VMName
VMhost
VMHostVolume
VHDType
VHDParentDisk
VHDFormatType
VHDLocation
VHDMaxSize
VHDCurrentSize
VHDExpandedInPercent
.EXAMPLE
Get-VIASCVMDiskInfo -VMName SERVER01 | Out-GridView
.EXAMPLE
Get-VIASCVMDiskInfo | Out-GridView
.NOTES
Created: 2016-11-25
Version: 1.0
Author - Mikael Nystrom
Twitter: @mikael_nystrom
Blog : http://deploymentbunny.com
Disclaimer:
This script is provided 'AS IS' with no warranties, confers no rights and
is not supported by the author.
.LINK
http://www.deploymentbunny.com
#>
Param(
$VMName = ''
)

if($VMName -eq ''){$VMs = Get-SCVirtualMachine -All}
if($VMName -ne ''){$VMs = Get-SCVirtualMachine -Name $VMName}

foreach ($Obj in ($VMs | Select-Object ComputerNameString -ExpandProperty VirtualHardDisks)){
$Data = [ordered]@{
VMName = $($Obj.ComputerNameString);
VMhost = $($Obj.VMHost);
VMHostVolume = $($Obj.HostVolume);
VHDType = $($Obj.VHDType);
VHDParentDisk = $($Obj.ParentDisk);
VHDFormatType = $($Obj.VHDFormatType);
VHDLocation = $($Obj.Location);
VHDMaxSize = "{0:N2}" -f $($Obj.MaximumSize/1GB);
VHDCurrentSize = "{0:N2}" -f $($Obj.size/1GB);
VHDExpandedInPercent="{0:P0}" -f $(($Obj.size/1GB)/($Obj.MaximumSize/1GB));
}
New-Object -TypeName PSObject -Property $Data
}
}

0 comments on commit d2a41fb

Please sign in to comment.