Thor Logo dbatools

Path

Get-DbaFile

Brandon Abshire, netnerds.net

Get-DbaFile View Source Brandon Abshire, netnerds.net Windows, Linux, macOS Synopsis Enumerates files and directories on remote SQL Server instances using xp_dirtree Description Searches directories on SQL Server machines remotely without requiring direct file system access or RDP connections. Uses the xp_dirtree extended stored procedure to return file listings that can be filtered by extension and searched recursively to specified depths. Defaults to the instance’s data directory but accepts additional paths for comprehensive file system exploration.

Read more

Join-DbaPath

Friedrich Weinmann (@FredWeinmann)

Join-DbaPath View Source Friedrich Weinmann (@FredWeinmann) Windows, Linux, macOS Synopsis Constructs file paths with correct separators for Windows and Linux SQL Server instances. Description Constructs file paths by joining multiple segments while automatically using the correct path separators (backslash for Windows, forward slash for Linux) based on the target SQL Server instance’s operating system. This function eliminates the guesswork when building file paths for backup files, exports, scripts, or other SQL Server operations that need to reference files on the remote server.

Read more

New-DbaDirectory

Stuart Moore

New-DbaDirectory View Source Stuart Moore Windows, Linux, macOS Synopsis Creates directories on SQL Server machines using the SQL Server service account Description Creates directories on local or remote SQL Server machines by executing the xp_create_subdir extended stored procedure. This is particularly useful when you need to create backup directories, log shipping paths, or database file locations where the SQL Server service account needs to have access. The function checks if the path already exists before attempting creation and returns the success status for each operation.

Read more

Resolve-DbaPath

Friedrich Weinmann (@FredWeinmann)

Resolve-DbaPath View Source Friedrich Weinmann (@FredWeinmann) Windows, Linux, macOS Synopsis Validates and resolves file system paths with enhanced error handling and provider verification. Description Validates and resolves file system paths with additional safety checks beyond PowerShell’s built-in Resolve-Path cmdlet. This function ensures paths exist and are accessible before performing database operations like backups, restores, or log file management. It provides enhanced error handling, provider validation (FileSystem, Registry, etc.), and supports both existing paths and parent directories for new file creation.

Read more

Test-DbaPath

Chrissy LeMaire (@cl), netnerds.net

Test-DbaPath View Source Chrissy LeMaire (@cl), netnerds.net Windows, Linux, macOS Synopsis Tests if files or directories are accessible to the SQL Server service account. Description Verifies file and directory accessibility from SQL Server’s perspective using the master.dbo.xp_fileexist extended stored procedure. This is essential before backup operations, restore tasks, or any SQL Server process that requires file system access. The function tests from the SQL Server service account’s security context, which may differ from your user account’s permissions.

Read more