Wednesday, May 03, 2017

I had previous written very breifly about creating a report on disk space using WMI

A much better, and very concise instruction for querying disk information (including %free) can  be found here:
https://msdn.microsoft.com/en-us/library/aa394173(v=vs.85).aspx
This could be easily adapted to be driven from a list of servers in a text file, in a query, or received from something like a net view command

Write-Host "Drive information for MY_Server"

Get-WmiObject -Class Win32_LogicalDisk -ComputerName MY_Server |
    Where-Object {$_.DriveType -ne 5} |
    Sort-Object -Property Name | 
    Select-Object Name, VolumeName, FileSystem, Description, VolumeDirty, `
        @{"Label"="DiskSize(GB)";"Expression"={"{0:N}" -f ($_.Size/1GB) -as [float]}}, `
        @{"Label"="FreeSpace(GB)";"Expression"={"{0:N}" -f ($_.FreeSpace/1GB) -as [float]}}, `
        @{"Label"="%Free";"Expression"={"{0:N}" -f ($_.FreeSpace/$_.Size*100) -as [float]}} |
    Format-Table -AutoSize

OUTPUT:
Drive information for MY_Server

Name VolumeName FileSystem Description             VolumeDirty DiskSize(GB) FreeSpace(GB) %Free
---- ---------- ---------- -----------             ----------- ------------ ------------- -----
A:                         3 1/2 Inch Floppy Drive                        0             0      
C:              NTFS       Local Fixed Disk        False               59.9          5.83 9.74 
D:   Programs   NTFS       Local Fixed Disk        False                200         18.03 9.02 
E:   Product_1  NTFS       Local Fixed Disk        False                250         99.57 39.83
F:   Product_2  NTFS       Local Fixed Disk        False                 20          7.02 35.09
R:   Product_3  MVFS       Network Connection                         78.13         48.83 62.5 


Tuesday, March 21, 2017

Minimally Logged Operations in SQL Server

I'm posting this mostly so I can find it later :)
The following article has a great table that defines when operations will be minimally logged.
https://technet.microsoft.com/en-us/library/dd425070(v=sql.100).aspx

Here's the table, just in case the link goes away at some point in the future:

Table Indexes

Rows in table Hints Without TF 610 With TF 610 Concurrent possible
Heap
Any
TABLOCK
Minimal
Minimal
Yes
Heap
Any
None
Full
Full
Yes
Heap + Index
Any
TABLOCK
Full
Depends (3)
No
Cluster
Empty
TABLOCK, ORDER (1)
Minimal
Minimal
No
Cluster
Empty
None
Full
Minimal
Yes (2)
Cluster
Any
None
Full
Minimal
Yes (2)
Cluster
Any
TABLOCK
Full
Minimal
No
Cluster + Index
Any
None
Full
Depends (3)
Yes (2)
Cluster + Index
Any
TABLOCK
Full
Depends (3)
No

I had previous written very breifly about  creating a report on disk space using WMI A much better, and very concise instruction for qu...