SQL Server instance Info with PowerShell

 The below query will retrieve SQL Server instance info from multiple servers. The below PowerShell command only works when we install "sqlserver" module. If any columns has lengthy values please provide that column in the last

Install-Module sqlserver

Import-Module sqlserver

cls
$ServerList=@("Server1","Server2")
$ServerList|
ForEach-Object{
$SingInstance=$_
$list=@{Name="WindowsServer";Expression={$SingInstance.($_.Name)}},(Get-ChildItem -Path "SQLSERVER:\SQL\$_") 
$list
}|Format-Table @{Name="WindowServerName";Expression={$_.ComputerNamePhysicalNetBIOS}},Status,State,ServerVersion,@{Name="InstanceID";Expression={$_.ServiceInstanceId} `
},ServiceName,@{Name="ServiceMode";Expression={$_.ServiceStartMode}},Product,ProductLevel,Edition,DisplayName,ServiceAccount -AutoSize -Wrap
#,ClusterName,AvailabilityGroups,,DatabaseEngineEdition

Comments

Popular posts from this blog

System.Data.SqlClient.SqlException (0x80131904): Execution Timeout Expired. The timeout period elapsed prior to completion of the operation or the server is not responding. ---> System.ComponentModel.Win32Exception (0x80004005): The wait operation timed out

Pre login Handshake or Connection Timeout Period

Transparent Data Encryption(TDE) with Master Key and Certificate in SQL Server