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

Re: Get startup type from service?

Update your Vista Drivers Update Your Drivers Now!!
Closed Thread
 
Thread Tools Display Modes
Old 01-17-2007   #1 (permalink)
Thomas Lee
Guest


 

Re: Get startup type from service?

In message <CB3D9FE3-FDB5-41EC-9732-B8F9FF622A6B@microsoft.com>, Andy
Webster <AndyWebster@discussions.microsoft.com> writes
>Hi
>
>Can anyone help?
>
>I want to get a list of services whose startup type is automatic but the
>Get-Service cmdlet does not seem to provide this property, seems odd.
>
>I cannot simply check if a service is running as I want to get a list of
>services whose startup type is set to automatic that are not currently
>running. I want this list because some services are not starting after a
>reboot even though they are set to automatic and I want to be informed of
>these when it happens


One way would be to look at the contents of the registry. Take a look at
my blog:
http://tfl09.blogspot.com/2007/01/us...owershell.html or
http://tinyurl.com/2hvj38.

To print out the services, you could do something like this:

$shive= "HKLM:\SYSTEM\currentcontrolset\Services\"
$Services=ls -path $shive
#
foreach ($s in $services) {
$sername=($s.name.split("\"))[($s.name.split("\").count-1)]
$ss= get-ItemProperty -path registry::$s -erroraction silentlycontinue
if ($ss) {"Servce: $sername, startuptype= $($ss.start)"}
}

Now- to do what you want, you'd need to get the actually running
services, and see if a service with servicename -eq $sername exists, ot
not.

HTH

Thomas

--
Thomas Lee
doctordns@gmail.com
MVP - Admin Frameworks and Security

My System SpecsSystem Spec
Closed Thread

Thread Tools
Display Modes



Similar Threads
Thread Thread Starter Forum Replies Last Post
Display actual file type, not description of the type Doug Vista file management 3 10-12-2007 01:40 AM
Display the actual type, rather than the description of the type Doug Vista General 4 10-11-2007 10:42 AM
Unable to find type [Drawing.Image]: make sure that the assembly containing this type is loaded IT Staff PowerShell 4 08-16-2007 08:55 PM
Re: Get startup type from service? Gaurhoth PowerShell 1 01-17-2007 08:36 AM


Update your Vista Drivers Update Your Drivers Now!!

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