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 bott开发者_C百科om 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.
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.
精彩评论