ÿþ<html> <head> <title>Get-SqlDefaultDir</title> </head> <body> <h1>Get-SqlDefaultDir</h1> <div>Returns the default location for data and log files for a SQL Server.</div> <h2> Syntax </h2> <code>Get-SqlDefaultDir [-sqlserver] &lt;Object&gt; [-dirtype] &lt;String&gt; [&lt;CommonParameters&gt;]</code> <h2> Detailed Description </h2> <div> The Get-SqlDefaultDir function returns the default location for data and log files for the specified SQL Server. </div> <h2> Related Commands </h2> <div> * <a href='Get-SqlDefaultDir.htm'>Get-SqlDefaultDir</a><br/> </div> <h2> Parameters </h2> <table border='1'> <tr> <th>Name</th> <th>Description</th> <th>Required?</th> <th>Pipeline Input</th> <th>Default Value</th> </tr> <tr valign='top'> <td>sqlserver&nbsp;</td> <td>&nbsp;</td> <td>true&nbsp;</td> <td>false&nbsp;</td> <td>&nbsp;</td> </tr> <tr valign='top'> <td>dirtype&nbsp;</td> <td>&nbsp;</td> <td>true&nbsp;</td> <td>false&nbsp;</td> <td>&nbsp;</td> </tr> </table> <h2> Input Type </h2> <div>None You cannot pipe objects to Get-SqlDefaultDir</div> <h2> Return Values </h2> <div>System.String Get-SqlDefaultDir returns a System.Stringt.</div> <h2> Notes </h2> <div>The DefaultFile and DefaultLog properties are only written to registry if you modify the properties in SSMS even setting the properties to same value will create the registry keys. If the properties have not been created Get-SqlDefaultDir will use the InstallDataDirectory properties. This seems to recreate how SSMS works.</div> <h2> Examples </h2> <h3> EXAMPLE 1</h3> <pre>Get-SqlDefaultDir "Z002\sql2k8" "Data"</pre> <div>This command returns the default data directory for the Z002\sql2k8 server.</div> <h3> EXAMPLE 2</h3> <pre>Get-SqlDefaultDir "Z002\sql2k8" "Log"</pre> <div>This command returns the default log directory for the Z002\sql2k8 server.</div> </body> </html>