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