Quantcast
Viewing all articles
Browse latest Browse all 7696

Accessing all sql server across the domain using powershell

 Hi,

 I have used  powershell   and found all MS SQL servers across the domain. I also used the following scrip  and by creating a SMO  connection tried to read information about each instance. for most cases I could retrieve data, but for some  I could not. That means  the connection get established at OS level and not to MS SQL  server. I  have checked the security and that is not the case. Any help would be appreciated  to help me to understand the issue.

#This script gets SQL Server database information using PowerShell

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

     # Create an SMO connection to the instance
     $s = New-Object ('Microsoft.SqlServer.Management.Smo.Server') $instance


Viewing all articles
Browse latest Browse all 7696

Trending Articles