Erik Darling points out a new DMV in SQL Server 2017:
SQL Server 2017 RC1 dropping recently reminded me of a couple things I wanted to blog about finding in there. One that I thought was rather interesting is a new iTVF called
dm_os_enumerate_filesystem
. It looks like a partial replacement forxp_cmdshell
in that, well, you can do the equivalent of running adir
command, with some filtering.The addition of a search filter is particularly nice, since the
dir
command isn’t exactly robust in that area. If you’ve ever wanted to filter on a date, well… That’s probably when PowerShell got invented.If I run a simple call to the new function like so…
Click through to see Erik use the new function.