Solved

Need script to determine thin disks and used space

Posted on 2015-02-10
6
88 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 117
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 your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
HP Laptop Drivers 13 24
Disk Ram Peak 1 14
Need a good Angular tutorial 5 28
Modify Policy using PowerShell 6 11
This is an issue that we can get adding / removing permissions in the vCSA 6.0. We can also have issues searching for users / groups in the AD (using your identify sources). This is how one of the ways to handle this issues and fix it.
A procedure for exporting installed hotfix details of remote computers using powershell
The viewer will learn how to count occurrences of each item in an array.
How to install and configure Citrix XenApp 6.5 - Part 1. In this video tutorial we have explained step by step installation of Citrix XenApp 6.5 Server on Windows Server 2008 R2 is explained in this video. We have explained the difference between…

707 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now