forked from DeploymentBunny/Files
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a new PowerShell module for SCVMM
- Loading branch information
1 parent
d988ab9
commit d2a41fb
Showing
1 changed file
with
60 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} | ||
} |