Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > PowerShell

get-service

Update your Vista Drivers Update Your Drivers Now!!
Closed Thread
 
Thread Tools Display Modes
Old 11-10-2006   #1 (permalink)
Bart Perrier
Guest


 

get-service

I'm trying to find a property of a service -- Start-Up Type (Automatic,
Manual, Disabled) -- but cannot seem to locate it. I have tried a number of
values found in get-service | get-member, all without success.

Does anyone know which property contains or method returns this value?

Thanks,
Bart Perrier



My System SpecsSystem Spec
Old 11-10-2006   #2 (permalink)
/\\/\\o\\/\\/ [MVP]
Guest


 

Re: get-service

you can use WMI for this
get-wmiObject win32_service

will get the startmode also

PoSH>gwmi win32_service


ExitCode : 1077
Name : Alerter
ProcessId : 0
StartMode : Disabled
State : Stopped
Status : OK

Greetings /\/\o\/\/
www.ThePowerShellGuy.com

"Bart Perrier" <bart_perrier@hotmail.com> wrote in message
news:uOxsnQPBHHA.4992@TK2MSFTNGP03.phx.gbl...
> I'm trying to find a property of a service -- Start-Up Type (Automatic,
> Manual, Disabled) -- but cannot seem to locate it. I have tried a number
> of values found in get-service | get-member, all without success.
>
> Does anyone know which property contains or method returns this value?
>
> Thanks,
> Bart Perrier
>



My System SpecsSystem Spec
Old 11-13-2006   #3 (permalink)
fixitchris
Guest


 

Re: get-service


How about through registry?

cd hklm:\system\currentcontrolset\services

How can i recurse through the hives and get the values of each "START" subkey?
I see the member of get-childitem GETVALUE and GETVALUENAMES but I'm not
sure how to pipe this....???
My System SpecsSystem Spec
Old 11-13-2006   #4 (permalink)
Andrew Watt [MVP]
Guest


 

Re: get-service

On Fri, 10 Nov 2006 12:15:06 -0600, "Bart Perrier"
<bart_perrier@hotmail.com> wrote:

>I'm trying to find a property of a service -- Start-Up Type (Automatic,
>Manual, Disabled) -- but cannot seem to locate it. I have tried a number of
>values found in get-service | get-member, all without success.
>
>Does anyone know which property contains or method returns this value?
>
>Thanks,
>Bart Perrier


As as far as I'm aware it's not exposed using the get-service cmdlet.

I assume that you want to know / set the startup setting fora small
number of services. I say that because you can't use wildcards with
the -name parameter of set-service.

One (not very elegant) approach is to use the -StartupType parameter
of the set-service cmdlet with the -whatif parameter also set to set
the startup value for a service of interest.

If that doesn't appeal then Marc's get-wmiobject Win32_Service
approach is one way to go.

Andrew Watt MVP
My System SpecsSystem Spec
Old 11-14-2006   #5 (permalink)
fixitchris
Guest


 

RE: get-service

function StartType ($start)
{
switch ($start) {
0 {return "Boot";Continue }
1 {return "System";Continue}
2 {return "Automatic";Continue}
3 {return "Manual";Continue}
4 {return "Disabled";Continue}
"" {return "Unknown";Continue}
}
}
gci hklm:\system\currentcontrolset\services | %{ $_.pschildname + ' : ' +
(StartType((gp $_.pspath).start)) ;$s=$_.pschildname;get-wmiobject
win32_service | select name, state | ? { $_.name -eq $s};}

How can i flip this code around so that I am matching HKLM values on the
win32_service returned names?

get-wmiobject win32_service | select name, state | %{gci
hklm:\system\currentcontrolset\services\ | %{(gp $_.pspath).start}}
My System SpecsSystem Spec
Closed Thread
Update your Vista Drivers Update Your Drivers Now!!

Thread Tools
Display Modes



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to install service to bypass Vista Interactive Services Detection Service kianlie84 Vista security 0 08-28-2008 02:25 AM
The Windows Firewall service terminated with service-specific erro Kraig Vista security 1 08-06-2008 05:51 PM
The Windows Firewall service terminated with service-specific erro DaMnIt Vista security 7 10-10-2007 12:34 PM
PDIHWCTL service failed, EventID: 7000, Source: Service Control Manager Eventlog Provider ls [sb] Vista General 0 06-20-2007 10:20 PM
Security Service and Windows Wireless Service stopped working Kolin Tregaskes Vista General 3 06-11-2007 12:34 PM


Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51