Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Need script to determine thin disks and used space

Posted on 2015-02-10
6
Medium Priority
?
99 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 123
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 2000 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

Automating Your MSP Business

The road to profitability.
Delivering superior services is key to ensuring customer satisfaction and the consequent long-term relationships that enable MSPs to lock in predictable, recurring revenue. What's the best way to deliver superior service? One word: automation.

Question has a verified solution.

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

A recent project that involved parsing Tableau Desktop and Server log files to extract reusable user queries for use in other systems. I chose to use PowerShell to gather the data, and SharePoint to present it...
What if you have to shut down the entire Citrix infrastructure for hardware maintenance, software upgrades or "the unknown"? I developed this plan for "the unknown" and hope that it helps you as well. This article explains how to properly shut down …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

722 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