Get-SQLFileSize

This function will allow you to query any server hosting SQL and return the file sizes for the each Database file(MDF) and Transaction Log file(LDF). This does not return back the file locations for each database.

 
 
 
 
 
3.5 Star
(2)
1,616 times
Add to favorites
Databases
3/31/2012
E-mail Twitter del.icio.us Digg Facebook
  • Instance name
    4 Posts | Last post May 08, 2013
    • Hi, I'm able to run this against SQL 2008 R2 servers that are using the default instance name, but when I try to run against a named instance, I get "WARNING: server\instancename not found!". I've tried different variations surrounded by quotes and other possible solutions, but none have worked so far. I went through the function and I don't see anything there where it would possibly care that I use a backslash in the Computer name, but obviously it doesn't like using that format. Any thoughts on this? I was going to start researching if the script would need to be modified to handle it, but figured I'd hit the source first. I realize you did this a few years ago... Thanks.
      
    • From looking at the function, it appears that my problem is the test-connection portion at the start. Since the servername\instance can't be reached by the Test-Connection cmdlet, it fails. I guess if I didn't care, that part of the if statement could be pulled out or another parameter could be added where the instance is specified by the user and added after the connection test -else if null, then default....
    • Ok. I'm answering my own question here which is appropriate considering I'm talking to myself. At any rate, the problem actually presents itself when running this against a SQL Failover Cluster in Active\Active configuration with multiple instances (not all of which are online). As soon as the function hits the first failure it craps out (as it appears to have been designed to do). I'm working on a way to get around that and only find "Active and online" instances.
    • Sorry, I've been busy with other things and havn't been able to respond to this. I'll try to take a look at this as well and maybe re-look at how I coded this and see what changes could be made. If you happen to come up with a better approach, I will be more than happy to add it into the existing function.
  • Nothing was returned
    1 Posts | Last post January 04, 2013
    • I think I was having the same problem as "Beavster".  If I tried to run it, it just brings me back to the same prompt I launched it from:
      ".\Get-SQLFileSize.ps1 -comp devsql1"
      I had to import it first (Import-Module .\Get-FileSize.ps1", then running it, it was simply the command "Get-SQLFileSize -comp <computer>"
      
      What is happening now, though is that I am getting the error "Warnign devsql1: Unable to locate Database Counters or Database does not exist on this server".  Same thing happens no matter which server I run it on.  Let me guess, they need to have remote execution turned on, and I need to run as an admin, right?
      I ask because this organization takes a long time to be given those privileges.
  • Nothing....
    2 Posts | Last post July 15, 2011
    • I would love to get this script to work but when I run it it returns nothing.  Not even an error message.  Any suggestions?
      
      Thanks.
    • Hi!
      Can you provide more information to me regarding this? What is the exact syntax that you are using to run the command?
      
      Thanks!