The Multifunctioning DBA

Jun 26 2009   5:46PM GMT

Finding what account a Service is running as

Colin Smith Colin Smith Profile: Colin Smith

Yesterday my boss came to me asking if I knew what server an account was running on. I know that the account is used as a SQL Server service account because of the naming convention that was used. I also know that the account is being used as I used the Quest Software cmdlet get-qaduser to query AD for the account and get the last logon time. Now I just needed to find out what server it was running on. With the account naming conventions that we use this normally would not be an issue but in this case it was as the server that it should have been used on no longer exists. The server had been virtualized and now has a new name. So I put together a script that would identify the server for me. I had the script read in all of my servers from my sqltab file that I have talked about before, and list all of the sql server services and the accounts that they were running as for each server. Here is a nice little one liner that will get you a listing of all sql server services on a server and the account that they are running as. Hope you can get some use out of this.

Get-WmiObject Win32_service -computername $computername | select name, startname | Where-Object{$_.name -like “*SQL*”}

 Comment on this Post

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when other members comment.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to: