How to check if SQL Server database files reside in a Resilient file system (ReFS) (PowerShell)

Introduction

This PowerShell script will demo how to detect database(s) files residing in resilient file system (ReFS) in Windows Server 2012.

Scenarios

Hosting databases on Windows Server 2012 ReFS is not supported for production use. If there is any database on ReFS file system, the script will give a warning.

Script

You can use this script in this way:
1. Run Microsoft PowerShell as Administrator

2. Run the script in the form: &Path
For example: & "C:\Users\Administrator\Desktop\CheckDBonReF\CheckDBonReFS.ps1"

3. Press Enter and enter the server name and choose the authentication

4. Press Enter and we抣l get the following figure:


Here are some code snippet for your reference:

PowerShell
Edit|Remove
foreach($ReFSDr in $ReFSDrive) 
{ 
   $ReFSD = [String]$ReFSDr 
   foreach($path in $DBInfo.Physical_Path) 
   { 
      $p = [String]$path  
      if($p.Contains($ReFSD)) 
      { 
       $i += 1 
      } 
    } 
}
 

Prerequisites

SQL Server 2005 /SQL Server 2008/SQL Server 2012

Windows Server 2012

Microsoft All-In-One Script Framework is an automation script sample library for IT Professionals. The key value that All-In-One Script Framework is trying to deliver is Scenario-Focused Script Samples driven by IT Pros' real-world pains and needs. The team is monitoring all TechNet forums, IT Pros' support calls to Microsoft, and script requests submitted to TechNet Script Repository. We collect frequently asked IT scenarios, and create script samples to automate the tasks and save some time for IT Pros. The team of All-In-One Script Framework sincerely hope that these customer-driven automation script samples can help our IT community in this script-centric move.