Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > PowerShell

Searching for two objects

Update your Vista Drivers Update Your Drivers Now!!
Closed Thread
 
Thread Tools Display Modes
Old 05-19-2008   #1 (permalink)
papa940911
Guest


 

Searching for two objects

Hello, I'm trying to filter out two services on 60 servers. I'm using the
following:

get-wmi-object -class Win32_service -computer name $remoteserver -filter
"name='xxx'"
but i can only find that one service. i'm having trouble adding the second
object to the filter option. I guess my question is what is correct syntax to
add the second object I'm filtering for?

thanks!

My System SpecsSystem Spec
Old 05-19-2008   #2 (permalink)
Kiron
Guest


 

Re: Searching for two objects

Use WQL's 'Or':

get-wmi-object -class Win32_service -computer name $remoteserver -filter "name='xxx' or name='yyy'"

--
Kiron
My System SpecsSystem Spec
Old 05-19-2008   #3 (permalink)
RichS [MVP]
Guest


 

RE: Searching for two objects

This should work - just need to add the computername parameter

Get-WmiObject -Class Win32_Service -Filter "Name='W32Time' or
Name='PlugPlay'" | Format-Table

and change the service names to whatever you need
--
Richard Siddaway
All scripts are supplied "as is" and with no warranty
PowerShell MVP
Blog: http://richardsiddaway.spaces.live.com/
PowerShell User Group: http://www.get-psuguk.org.uk


"papa940911" wrote:
Quote:

> Hello, I'm trying to filter out two services on 60 servers. I'm using the
> following:
>
> get-wmi-object -class Win32_service -computer name $remoteserver -filter
> "name='xxx'"
> but i can only find that one service. i'm having trouble adding the second
> object to the filter option. I guess my question is what is correct syntax to
> add the second object I'm filtering for?
>
> thanks!
My System SpecsSystem Spec
Old 05-19-2008   #4 (permalink)
papa940911
Guest


 

RE: Searching for two objects

Cool! It worked! thanks! that was easy..

"RichS [MVP]" wrote:
Quote:

> This should work - just need to add the computername parameter
>
> Get-WmiObject -Class Win32_Service -Filter "Name='W32Time' or
> Name='PlugPlay'" | Format-Table
>
> and change the service names to whatever you need
> --
> Richard Siddaway
> All scripts are supplied "as is" and with no warranty
> PowerShell MVP
> Blog: http://richardsiddaway.spaces.live.com/
> PowerShell User Group: http://www.get-psuguk.org.uk
>
>
> "papa940911" wrote:
>
Quote:

> > Hello, I'm trying to filter out two services on 60 servers. I'm using the
> > following:
> >
> > get-wmi-object -class Win32_service -computer name $remoteserver -filter
> > "name='xxx'"
> > but i can only find that one service. i'm having trouble adding the second
> > object to the filter option. I guess my question is what is correct syntax to
> > add the second object I'm filtering for?
> >
> > thanks!
My System SpecsSystem Spec
Closed Thread

Thread Tools
Display Modes



Similar Threads
Thread Thread Starter Forum Replies Last Post
Using SMO objects Carlos Felipe França da Fonseca PowerShell 0 07-06-2008 03:57 PM
Formating objects Shay Levi PowerShell 2 09-09-2007 12:00 PM
Instantiating COM objects Mycroft PowerShell 12 05-24-2007 08:47 PM
Searching for deleted AD objects in PowerShell RichS PowerShell 1 04-29-2007 08:06 AM
Outerglow on 3D objects AlexB Avalon 2 11-24-2006 11:30 PM


Update your Vista Drivers Update Your Drivers Now!!

Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008