dbatools is a free PowerShell module with over 200 SQL Server administration, best practice and migration commands included.

Please note that documentation and command names may be out of date while we work furiously towards 1.0


New-DbaSqlDirectory

Creates new path as specified by the path variable. Uses master.dbo.xp_create_subdir to create the path.
Returns $true if the path can be created, $false otherwise.

Screenshots

Examples

If the SQL Server instance sqlcluster can create the path L:\MSAS12.MSSQLSERVER\OLAP it will do and return $true, if not it will return $false.

New-DbaSqlDirectory -SqlServer sqlcluster -Path L:\MSAS12.MSSQLSERVER\OLAP

If the SQL Server instance sqlcluster can create the path L:\MSAS12.MSSQLSERVER\OLAP it will do and return $true, if not it will return $false. Uses a SqlCredential to connect.

$credential = Get-Credential
New-DbaSqlDirectory -SqlServer sqlcluster -SqlCredential $credential -Path L:\MSAS12.MSSQLSERVER\OLAP

Author

This command was created by Stuart Moore. You can find Stuart on Twitter and his blog.

Get-Help

From PowerShell, execute Get-Help New-DbaSqlDirectory -Detailed for more information on this function.

Source Code

Want to see the source code? View New-DbaSqlDirectory.ps1 on GitHub
 

Related commands