Using impersonation to check services on a remote machine.

User on machine A needs to see if services are running on machine B.  User on machine A is your average windows user, no admin rights or anything special.  There is an account that is used on machine B that IS an admin account and this account is what is used to install/unistall services, do updates, etc.

The admin account on machine B does not exist on machine A.  Can I use impersonation to create an app that will allow the user of machine A to impersonate the admin user on machine B and check the services?  Both machines are in the same domain.  The users account is a domain account, but the admin account on machine B is only on that machine...if that matters.

So far I haven't gotten this to work.  Not sure if it will according to this...

If it can't be done this way, can it be done using WMI?
LVL 12
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

I recommend using psservice (from the sysinternals suite).

In the command line parameters you can specify the username and password to use for your query.
rgn2121Author Commented:
I appreciate the reponse, but I need to be able to do this without an additional external tool.
powershell lets you run scripts on another machine so user PS to run the following command: sc queryex type= service state= all | find "_NAME"
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

actually I just saw that powershell has a built-in command for this.  See
lastly, here is a little more info about remote execution with powershell (in general):

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
so user PS to run the following command
Wow, I mistyped that
what I meant to say was
so use PS to run the following command
rgn2121Author Commented:
CodeCrusier...Will it matter if that account exists on the client workstation?  Or will it just work because it is an admin on the host machine...?  I would like to not have to create an account on every workstation.  Just that I can supply the credentials in a config file and it will use those to logon remotely and do the work...
It needs to be an account on the remote computer to which you are connecting.
rgn2121Author Commented:
K...I have that.  So I don't have to have the same account on the client pc that I am connecting from correct?
rgn2121Author Commented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.