Hi,
I'm looking to get a list of log on as service accounts on remote computers. I can output the service names and accounts but is there any way to output the server name etc ($SQLInstance.SQLInst and $SQLInstance.SQLNamed in the code below) so I can differentiate between them?
Here is my work in progress:
Thanks.# Import list of Servers
$SIList=IMPORT-CSV 'C:\PSH Scripts\SQL Related\SQL_Instances.csv' # Step through Each Item in the List foreach ($SQLInstance in $SIList) { write-host $SQLInstance.SQLInst $SQLInstance.SQLNamed # Get Service Acounts Info $report += Get-WMIObject Win32_Service -ComputerName $SQLInstance.SQLInst | Where-Object{$_.name -like '*SQL*'} | Sort-Object -Property StartName | select Name, StartName } $report | convertto-html | out-file 'C:\PSH Scripts\SQL Related\SQL_Instances.html'