The script is available for download from https://gallery.technet.microsoft.com//How-to-rename-mdf-and-ldf-29bf1d5e. You can also use Microsoft Script Browser for Windows PowerShell ISE to download the sample with one button click from within your scripting environment.
This script is to rename .mdf files and .ldf files based on the name of its database name.
This sample will demonstrate how to rename .mdf files and .ldf files based on the name of its database name. Sometimes, people renamed the name of databases, but the logical and physical name of .mdf and .ldf files will not change automatically. So this script will help rename the logical and physical names of files according to their database name.
You can find more All-In-One Script Framework script samples at https://aka.ms/onescriptingallery