Solved

Need script to determine thin disks and used space

Posted on 2015-02-10
6
91 Views
Last Modified: 2015-03-02
I found this site that lists a PowerCLI script but I must be doing something wrong since the CSV is always blank, no headers. There were some comments at the bottom but it didn't seem to go anywhere.
Script I Tested

Can someone suggest a script that I can use that will allow me to see all VM's and disks that are thin provisioned, what their total size is, what they are currently using and if possible how much space they need to expand to the entire amount. We need to see how much more space is needed to expand all thin disks in the farm.
0
Comment
Question by:REIUSA
  • 2
6 Comments
 
LVL 119
ID: 40601004
0
 

Author Comment

by:REIUSA
ID: 40601463
Hello,
That thread is to get info on Datastores and free space. This thread is to get info on VM's with thin provisioned disks, what they are using, and what the max they can use is with the purpose of determining how much space is needed in a cluster to convert all those thin disks to thick
0
 
LVL 35

Accepted Solution

by:
David Todd earned 500 total points
ID: 40631424
Hi,

I use two routines I downloaded beign out-DataTable and then write-DataTable, but here is the main body of my script

# Main Body
foreach( $s in Invoke-Sqlcmd -Query ‘select distinct ss.FQDN as ServerName from dbo.SQLServer ss where isWMIWorking = 1 and ( DateDecommissioned is null or DateDecommissioned > dateadd( day, datediff( day, 0, getdate()), 0 )) and ( Domain is null or Domain like ''mydomain.local'' ) ’ -Database mylogging -ServerInstance myserver\myinstance ) {
    write-output $s.ServerName
   
    #$d = null
   
   
    $d = Get-WmiObject -computername ( $s.ServerName ) Win32_LogicalDisk -filter "DriveType=3" | foreach {
        add-member -in $_ -membertype noteproperty UsageDT $((Get-Date).ToString("yyyy-MM-dd HH:mm:ss"))
        add-member -in $_ -membertype noteproperty SizeGB $([math]::round(($_.Size/1GB),2))
        add-member -in $_ -membertype noteproperty UsedGB $([math]::round((($_.Size - $_.FreeSpace ) /1GB ), 2 ))
        add-member -in $_ -membertype noteproperty FreeGB $([math]::round(($_.FreeSpace/1GB),2))
        add-member -in $_ -membertype noteproperty PercentUsed $([math]::round(((1 - [float]$_.FreeSpace/[float]$_.Size) * 100),2)) -passThru
        } | Select UsageDT, SystemName, Caption, VolumeName, SizeGB, UsedGB, FreeGB, PercentUsed | out-DataTable      
    ;
   
    Write-DataTable -ServerInstance "myserver\myinstance" -Database mylogging -TableName DiskUsage -Data $d

    }
0
 

Author Closing Comment

by:REIUSA
ID: 40640111
Thanks I will give that a try.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If your vDisk VHD file gets deleted from the image store accidentally or on purpose, you won't be able to remove the vDisk from the PVS console. There is a known workaround that is solid.
A clone is a duplicate copy. Sheep have been cloned and maybe someday even people will be cloned, but disk cloning (performed by the hard drive cloning software) is a vital tool used to manage and protect data. Let’s look at what hard drive cloning …
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question