Solved

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

Posted on 2013-01-30
4
306 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
  • 2
  • 2
4 Comments
 
LVL 39

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 39

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This script checks a path to see if a folder exists. If the folder does exist you will get output "The folder has previously been created. No action taken" If not it will create the folder. Then adds one user modify permission to the folder. It …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

760 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now