October 6, 2023 at 5:55 am
I have about 400 windows servers. How can I check if SQL Server is installed on any of those servers. Thanks.
October 6, 2023 at 6:05 am
Can I use a script to find that info please? Thx
October 6, 2023 at 9:29 am
System administrators usually have an inventory tool
You could start with the Microsoft assessment toolkit https://www.mssqltips.com/sqlservertip/7428/microsoft-assessment-and-planning-toolkit-inventory-sql-servers/
Scripting: probably using wmi
October 6, 2023 at 9:31 am
Scripting: using dba-tools https://docs.dbatools.io/Find-DbaInstance.html
October 6, 2023 at 5:52 pm
Thanks everyone! How can I export the output to a csv file please? I tried the below export-csv -append -path but I don't see the servername and instancename columns being written to the output. Any ideas please? Thanks.
$SQLInstances = Import-Csv C:\server_test.csv |% { Invoke-Command -ComputerName $_.ServerName {(Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server').InstalledInstances
}
}
foreach ($sql in $SQLInstances) {
[PSCustomObject]@{
ServerName = $sql.PSComputerName
InstanceName = $sql | Export-Csv -Append -Path C:\output.csv -NoTypeInformation
}
}
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy