$Header = @"
TABLE {border-width: 1px; border-style: solid; border-color: black; border-collapse: collapse;}
TH {border-width: 1px; padding: 3px; border-style: solid; border-color: black; background-color: #6495ED;}
TD {border-width: 1px; padding: 3px; border-style: solid; border-color: black;}
"@
Get-WmiObject win32_Service | where {$.DisplayName -match “SQL Server”} | select SystemName, DisplayName, Name, State, Status, StartMode, StartName |
ConvertTo-Html -Property SystemName,Name,State,Status,StartMode,StartName -Head $Header |Out-File C:\Services$((Get-Date).ToString(‘MM-dd-yyyy_hh-mm-ss’)).‘html’
The above code works on a single server and it generates a HTML table successfully.I need to run the code on multiple sql servers and create the output in a single html file as above.I need to past the server list in a text file(C:\abcd\servers.txt)
How can I do this?
Thanks