Accessing LinkedServer properties via SQL Server SMO API

I have a powershell script to iterate through a list of LinkedServer objects in a SQL Server with some code like this:

foreach($linkedServer in $instance.LinkedServers)
{       
... some code ...
}   

I want to find out information on the default security of a linked server. To see what I mean, load SQL Server Management Studio and open a linked server. If you don't have any, just create one to a remote server. Click on the Security tab and you will see a list of linked server login mappings (LinkedServerLogins collection in SMO). At the bottom of the screen will be a default setting in the section called "For a login not defined in the list above...". I cannot find anywhere in the SMO object model to get to this information. Is it possible?

Thanks, Mark.

Answers


It seems to be in the linked server login properties:

foreach($linkedServer in $instance.LinkedServers)
{   
    "LinkedServer:" + $linkedServer.Name

    foreach($linkedServerLogin in $linkedServer.LinkedServerLogins)
    {
        " LinkedServerLogin:" + $linkedServerLogin.Name
        foreach($property in $linkedServerLogin.Properties)
        {
            "  Property:" + $property.Name + " - " + $property.Value
        }
    }
} 

Impersonate and RemoteUser are included in the properties.


Need Your Help

Android: calling a method in an activity from a service (on same Activity)

android service android-activity

I've had a similar question but the answer did not entirely fix my problem.

WPF Binding Properties of a new Button Template

c# wpf templates button binding

Ok i have made a new style for the Buttons that i want to use in my app. The general idea is to have 10 square Button in which i will have an Image and under this a TextBlock.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.