Solved

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

Posted on 2013-01-30
4
314 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

What Is Transaction Monitoring and who needs it?

Synthetic Transaction Monitoring that you need for the day to day, which ensures your business website keeps running optimally, and that there is no downtime to impact your customer experience.

Question has a verified solution.

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

This script can help you clean up your user profile database by comparing profiles to Active Directory users in a particular OU, and removing the profiles that don't match.
The Nano Server Image Builder helps you create a custom Nano Server image and bootable USB media with the aid of a graphical interface. Based on the inputs you provide, it generates images for deployment and creates reusable PowerShell scripts that …
The viewer will learn how to dynamically set the form action using jQuery.
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 …

695 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