x

Sql Root Directory and error log location

Hi, Can anyone help me in finding the SQL server Root directory and error log location using a sql script for multi-instances, cluster and non cluster servers.

more ▼

asked Jun 23, 2011 at 07:22 PM in Default

avatar image

srivivek
535 41 42 47

(comments are locked)
10|1200 characters needed characters left

2 answers: sort voted first

SQL script will not be the best candidate for this.

I suggest you take a look for a PowerShell script. As the installation directory is stored in the registry and the log location is part of the startup parameters of the SQL Server service.

Anyway you can take a look here for the inspiration of the t-sql solution to retrieve installation directory: How to find the SQL Server install directory from tsql

more ▼

answered Jun 24, 2011 at 01:36 AM

avatar image

Pavel Pawlowski
22.7k 10 15 26

(comments are locked)
10|1200 characters needed characters left

I was playing around with some stuff on a cluster and using PowerShell you can actually use this to get your information (if you have PowerShell running on the servers of course). You will also need SMO loaded, which this is already there if SSMS is installed on the host machine.

[System.Reflection.Assembly]::LoadWithPartialName('Microsoft.SqlServer.Management.SMO') |
out-null

$s = New-Object 'Microsoft.SqlServer.Management.Smo.Server' instance_name
$s.Information.RootDirectory | Write-Host -foreground Red
$s.Information.ErrorLogPath | Write-Host -foreground Red
$s.Information.MasterDBPath | Write-Host -foreground Red
$s.Information.MasterDBLogPath | Write-Host -foreground Red

more ▼

answered Jun 30, 2011 at 12:30 PM

avatar image

Shawn_Melton
6.4k 21 25 34

(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.

Topics:

x1014
x74
x22
x5
x2

asked: Jun 23, 2011 at 07:22 PM

Seen: 2269 times

Last Updated: Jun 23, 2011 at 07:22 PM

Copyright 2016 Redgate Software. Privacy Policy