Solved

Quest PowerShell  used to get services

Posted on 2012-04-13
8
489 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
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Utilizing an array to gracefully append to a list of EmailAddresses
This article will help you understand what HashTables are and how to use them in PowerShell.
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

920 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

16 Experts available now in Live!

Get 1:1 Help Now