Solved

Need script to determine thin disks and used space

Posted on 2015-02-10
6
94 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
6 Comments
 
LVL 121
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

Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

A project that enables an administrator to perform actions within a user session context not just at the time of login but any time later on day(s) or week(s) later.
In previous parts of this Nano Server deployment series, we learned how to create, deploy and configure Nano Server as a Hyper-V host. In this part, we will look for a clustering option. We will create a Hyper-V cluster of 3 Nano Server host nodes w…
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…

632 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