Solved

Need script to determine thin disks and used space

Posted on 2015-02-10
6
92 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 120
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

How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

Question has a verified solution.

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

Suggested Solutions

This script can help you clean up your user profile database by comparing profiles to Active Directory users in a particular OU, and removing the profiles that don't match.
The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
Learn the basics of if, else, and elif statements in Python 2.7. Use "if" statements to test a specified condition.: The structure of an if statement is as follows: (CODE) Use "else" statements to allow the execution of an alternative, if the …
The viewer will learn how to dynamically set the form action using jQuery.

749 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