Solved

Need PS script to get List of Services for non-system accounts

Posted on 2013-01-30
4
313 Views
Last Modified: 2013-02-03
Hello Experts,

      I am in need of a special Power-Shell script that can scan a list of servers (located in text document), get a list of “Windows Services” running “that are started by none-system account” and then dump information in to excel document for each device.  What do I mean by “none-system account”..?  I need to get the pasiffic windows services running on each computer that have been started by the “Administrator user account” or other User accounts (i.e. not the System/Local-Resource). Then Export that information for each device in to an excel file…..
0
Comment
Question by:amstoots
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 40

Expert Comment

by:footech
ID: 38836522
I'm unclear on a few points.  Do you want a separate document for each computer?  Is a .CSV file OK?  What information about the service do you need?  Do you only want the services that are running or ones that are in other states as well?
0
 

Author Comment

by:amstoots
ID: 38836579
I looking to put everything on to one spreadsheet( i.e. csv) with the computer name, service running,  the status, and user account its tied too ( i.e. administrator, other user accounts) that are not running by the system account... thank you for your help with this task...
0
 
LVL 40

Accepted Solution

by:
footech earned 500 total points
ID: 38836864
This should do what you asked.  I haven't included any error checking for down computers or blank results, so you may see some errors.  BTW, above you mentioned "status" of a service, so that's what I included, but just wanted make sure you knew that "status" is different than "state".
$out = @()
$computers = Get-Content c:\temp\computerlist.txt
ForEach ($computer in $computers)
{
  $out += ((gwmi win32_service -computername $computer -filter "StartName != 'LocalSystem' AND NOT StartName LIKE 'NT Authority\\%' AND State = 'Running'") | Select @{name="Computer";expression={$computer}},Name,Status,@{name="Account";expression={$_.StartName}})
}
$out | Export-CSV c:\temp\services.csv -notype

Open in new window

0
 

Author Closing Comment

by:amstoots
ID: 38849245
The script worked perfect....  thank you for your help.......:;;
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question