Can I get all the SQL related services(sql server,agent,reporting server etc) information like serviceaccount being used,status by passing sql instance name and not the windows server name?
I can get using windows machine name using
gwmi win32_service -computername but if I pass instance name it fails.
Appreciate your help
My first guess is that you are having problems with instances that have '$' in the name.
Be sure to use single quotes like 'MSSQL$CONTOSO' to avoid variable expansion.
E.G. - Get-Service -Name 'MSSQL$CONTOSO'
Yes, you can, but it'll require either best guess, or SMO. Get-WmiObject and Get-Service require the proper NetBIOS name of the SQL Server. Your query may actually be as simple as this
Or if you are using a bunch of aliases that won't work with Wmi well, you can use ManagedComputer, which is found within SMO and the SDK (basically, it'll work if you have SQL Server Management Studio installed). ManagedComputer is the SMO equivalent of SQL Configuration Manager.
Powered by IDERA