keyongtech


  keyongtech > windows.* > windows.powershell

 #1  
10-02-08, 10:32 PM
Blake
I want to see if a service is RUNNING on a remote machine (it is a Windows
2000 server and can't run PS locally)

since the remote service stuff doesn't seem fully functional in this
release, I am trying to leverage PS and the 'sc.exe' command

I have this:

c:\windows\system32\sc \\unity01 query "alerter" | foreach {"$_"} |
select-string "running"
STATE : 4 RUNNING

What I want is 'if there is some output, run another command'. So if the
service is running, I do something else.

Thanks
Blake
 #2  
10-02-08, 11:06 PM
PaulChavez
Have you tried using WMI for this?

gwmi -computer unity1 win32_service -filter "name='alerter'" |
foreach-object { if ($_.State -eq 'Running') {"Put your command here"}}

Now I wasn't clear if you wanted to run a command remotely, this example
will just execute a command on whatever machine is running the powershell
session.


"Blake" wrote:
[..]
 #3  
10-03-08, 01:15 PM
sapienscripter
Although you can still use WMI to remotely manage the server. Here's
another way: 'Managing Services with PowerShell and ADSI | SAPIEN
Technologies'
(http://blog.sapien.com/index.php/200...hell-and-adsi/)
Similar Threads
Thread Thread Starter
KB911280 Prohibits RoadRunner Dial Up Service Vulnerability in Routing and Remote Access Could Allow Remote Code Execution

All, I have found patch KB911280 "Vulnerability in Routing and Remote Access Could Allow Remote Code Execution" interferes with RoadRunner Dial-Up Internet Access service by...

Nospam
ASP.Net client app, Windows Service remote server, class library remote object

First let me explain my architecture. I have an ASP.Net (VB.Net) application that is the client, a VB.Net Windows Service that is the remote server for the VB.Net class...

Michael Blevins
2K3: The Routing and Remote Access service terminated with service-specific error 691 (0x2B3).

Hi When we configure RRAS on our W2K3 server with windows authentication it does not start and it returns this error in the event log: The Routing and Remote Access service...

Ben
How to solve the PXE error when I remote deploy with Remote Boot service?

Now, I've done these tasks following the help document 1. Install Remote Boot Server in the development system. Then I can find "Remote Boot Services" & "Trivial File...

Arlin
The Routing and Remote Access service terminated with service-specific error 16389.

Hello all, When i try to start the Routing and Remote Access service the following error occours: The Routing and Remote Access service terminated with service-specific...

Derck Weelink

Privacy Policy | All times are GMT. The time now is 03:38 PM.

Merging Information Logo
[Deutschland] [Espaņa] [France] [Italia] [Nederland] [Polska] [United Kingdom]