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

Re: how to determine if wmi namespace exists

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


 

Re: how to determine if wmi namespace exists


You can get all the classes with the -list parameter and filter the one you
want with where:

if(get-wmiobject -list | where { $.name -eq "<className>"}){
"class exist"
}


---
Shay Levi
$cript Fanatic
http://scriptolog.blogspot.com
Quote:

> Hi,
>
> Is there a way to determine if a wmi namespace exists with
> get-wmiobject? I want to see if it exists before I query it,
> otherwise I get an error message.
>
> Thanks in advance,
>


My System SpecsSystem Spec
Closed Thread

Thread Tools
Display Modes



Similar Threads
Thread Thread Starter Forum Replies Last Post
Namespace mapping tool Michel Racicot .NET General 1 03-07-2008 10:10 AM
if a file exists NeilOz PowerShell 6 01-03-2008 02:33 AM
Using namespace directive? Duncan Smith PowerShell 10 08-19-2007 11:14 PM
URI to namespace extension Brad O'Hearne PowerShell 0 04-09-2007 10:07 AM
tag not valid in namespace Sharon Avalon 1 03-29-2006 08:07 AM


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