Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Powershell Remote Commands

I'm trying to run the get-service command on a remote machine in powershell. After doing some research, it appears this is only possilbe n powershell 2 CTP, which I cannot use as I need to use the version of powershell installed with exchange, which is usualy 1. It seems the -computerName switch is only availible in get-service in ps 2. So i've pretty much decided its a no-go, but wanted to see if anyone here had an clever solutions before I give up on it.

like image 222
Sam Cogan Avatar asked Jul 12 '26 04:07

Sam Cogan


2 Answers

Those are all fine answers but they only help you with Services. What you want is somethign that will work with anything:

WINRS is your best friend!

[4120:0]PS> winrs -r:localhost powershell get-service h*

Status   Name               DisplayName
------   ----               -----------
Running  hidserv            Human Interface Device Access
Running  hkmsvc             Health Key and Certificate Management
Stopped  HomeGroupListener  HomeGroup Listener
Running  HomeGroupProvider  HomeGroup Provider

BTW - WINRS uses WS-MAN which means it will work across firewalls.

Experiment! Enjoy! Engage!

Jeffrey Snover [MSFT] Windows Management Partner Architect

like image 50
Jeffrey Snover - MSFT Avatar answered Jul 13 '26 21:07

Jeffrey Snover - MSFT


Well, you can go directly to WMI the get the service information.

gwmi Win32_Service -computername FOO
like image 25
EBGreen Avatar answered Jul 13 '26 21:07

EBGreen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!