Solved

Quest PowerShell  used to get services

Posted on 2012-04-13
8
488 Views
Last Modified: 2012-04-18
WE do not have 2008r2 DC's nor do we have active directory web installed.  I'm trying to use Quest tools with native powershell to pull some reports.

I need to obtain all services running on computers in a specific OU.

Get-QADComputer -SearchRoot 'OU=App,OU=Servers,DC=xxxx,DC=xxx,DC=xxx' | Get-Service

When i run this it does not work.  

Thanks
0
Comment
Question by:niaidsdt
  • 5
  • 3
8 Comments
 
LVL 6

Expert Comment

by:slidingfox
ID: 37843245
Try this.

$computers = Get-QADComputer -SearchRoot 'OU=App,OU=Servers,DC=xxxx,DC=xxx,DC=xxx' | Select -expand Name

$computers | Get-Service

Open in new window

0
 
LVL 6

Expert Comment

by:slidingfox
ID: 37843253
Ignore me, thats rubbish and it won't work. I'll have something else shortly.
0
 

Author Comment

by:niaidsdt
ID: 37843305
YOu put me on the right track

cls
$computers = Get-QADComputer -SearchRoot 'OU=Test,OU=Servers,DC=xxx,DC=xx,DC=xxx'

foreach ($computers1 in $computers)
{
Get-Service
}
0
 
LVL 6

Assisted Solution

by:slidingfox
slidingfox earned 200 total points
ID: 37843321
Yeah, thats pretty much what I came up with.

$computers = Get-QADComputer -SearchRoot 'OU=App,OU=Servers,DC=xxxx,DC=xxx,DC=xxx' | Select -Expand Name

Foreach ($computer in $computers) {

    Get-Service -Computername $computer | 
        Add-Member -MemberType NoteProperty -Name Computer -Value $Computer -passthru | 
        Select Computer,Status,Name,DisplayName | 
        Format-Table -auto
    
}

Open in new window

0
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

 

Author Comment

by:niaidsdt
ID: 37843372
Cool.  Any way to ouput the account the service is running under?
0
 

Author Comment

by:niaidsdt
ID: 37843559
looks like the get-service doesn't have the smarts to figure out all information about the services running.  Ended up having to use


   Get-WmiObject win32_service -ComputerName $computer |
   select SystemName,DisplayName,StartName |
   Format-Table -auto
0
 

Accepted Solution

by:
niaidsdt earned 0 total points
ID: 37843972
Ended up using this one

cls
##      On Error continue
"$ErrorActionPreference = silentlyContinue"
$log = 'C:\Log\services.txt'
$computers = Get-QADComputer -SearchRoot 'ou=servers,DC=xx,DC=xx,DC=xx' | Select -Expand Name

Foreach ($computer in $computers)
{

   Get-WmiObject win32_service -ComputerName $computer |
   select SystemName,DisplayName,StartName |
   
   Format-Table -auto >> $log  
}
0
 

Author Closing Comment

by:niaidsdt
ID: 37859714
Script i created gave me exactly what i was looking for.  <br /><br />slidingfox definitely put me on the right track and it was much appreciated.
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
How to sign a powershell script so you can prevent tampering, and only allow users to run authorised Powershell scripts
This video discusses moving either the default database or any database to a new volume.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

707 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

13 Experts available now in Live!

Get 1:1 Help Now