• You might want to try additional properties, because maybe the user does not have rights to VIEW SERVER STATE/DEFINITION .

    Or maybe the 2 properties are not being initialized because of the location of the user database files.

    Try the following alternatives:

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

    $server = new-object ('Microsoft.SqlServer.Management.Smo.Server') 'localhost'

    $setting1 = $server.Settings.DefaultFile

    $setting2 = $server.Settings.DefaultLog

    $setting3 = $server.Information.MasterDBPath

    $setting4 = $server.Information.MasterDBLogPath

    $setting5 = $server.InstallDataDirectory