how to write powershell script to list the available databases from multiple servers?
<p>Requirement : My requirement is I have to list the available databases from 150 servers. Each server has minimum 1 and maximum 15 instances.</p>

<p>Below script is working only for instances listed in sqlserver.txt but I need to fetch multiple instances across multiple servers.</p>

<p>Help is highly appriciated.</p>

<pre><code>ForEach ($instance in Get-Content "C:\PowerSQL\SQL_Servers.txt") 
{ 
    Import-Module SQLPS -DisableNameChecking 
    Invoke-SQLcmd -Server $instance -Database master 'select @@servername as InstanceName,name as DatabaseName,state_desc as DBStatus from sys.databases' | Format-Table       
}
</code></pre>