Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2013-01-30
4
Medium Priority
?
316 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:Mike
[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 41

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:Mike
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 41

Accepted Solution

by:
footech earned 2000 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:Mike
ID: 38849245
The script worked perfect....  thank you for your help.......:;;
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

In previous parts of this Nano Server deployment series, we learned how to create, deploy and configure Nano Server as a Hyper-V host. In this part, we will look for a clustering option. We will create a Hyper-V cluster of 3 Nano Server host nodes w…
There are times when we need to generate a report on the inbox rules, where users have set up forwarding externally in their mailbox. In this article, I will be sharing a script I wrote to generate the report in CSV format.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Suggested Courses

636 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