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

[SUGGESTION] New switch parameter for Get-WmiObject

Closed Thread
 
Thread Tools Display Modes
Old 05-07-2008   #1 (permalink)
Shay Levi
Guest


 

[SUGGESTION] New switch parameter for Get-WmiObject


Get-WmiObject is one of the most used cmdlets in PowerShell, sometimes WMI
is the only way to get/make system configuration changes on remote computers.
It is considered a best practice to verify remote computers availability
before trying to connect them.

Given that, it is up to the user/scripter to write that functionality, ping
remote computer(s), filter the ones that are not available, etc.

Wouldn't it be nice to have a -ping switch parameter?

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


Old 05-11-2008   #2 (permalink)
Alex K. Angelopoulos
Guest


 

Re: [SUGGESTION] New switch parameter for Get-WmiObject

That really _is_ one of the frustrating problems with remote access
problems. I think it may make more sense to provide a distinct tool for
confirming remote node availability, though, given that a wide range of
tools can encounter the same problem under certain circumstances. It may not
happen, though, simply because a tunable script that filters nodes by
availability is possible.

As an example, here's a Test-IPNode.ps1 script I use. The script reads
system IDs (IP/DNS/WINS style names) from the input stream and drops any
that don't have perfect responses. A more full-featured version can be made
that allows you to control timeouts, number and size of packets, and so on.

#Test-IPNode.ps1
process {
$_ | Where {(Get-WmiObject Win32_PingStatus `
-Filter "address='$_'" `
).StatusCode -eq 0}
}

I haven't checked the available community extensions lately, but it's
possible someone has already wrapped up the PingStatus functionality in a
cmdlet.



"Shay Levi" <no@xxxxxx> wrote in message
news:89228ed2291668ca7e5d6b545244@xxxxxx
Quote:

>
> Get-WmiObject is one of the most used cmdlets in PowerShell, sometimes WMI
> is the only way to get/make system configuration changes on remote
> computers. It is considered a best practice to verify remote computers
> availability before trying to connect them.
>
> Given that, it is up to the user/scripter to write that functionality,
> ping remote computer(s), filter the ones that are not available, etc.
>
> Wouldn't it be nice to have a -ping switch parameter?
> ---
> Shay Levi
> $cript Fanatic
> http://scriptolog.blogspot.com
>
>
Old 05-12-2008   #3 (permalink)
Shay Levi
Guest


 

Re: [SUGGESTION] New switch parameter for Get-WmiObject

Hi Alex,

I've blogged a solution before (using filters), but wondered if such built-in
functionality can help.
You're the only one who reponded to this thread so I guess no one is realy
interested (or finds it useable)


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

> That really _is_ one of the frustrating problems with remote access
> problems. I think it may make more sense to provide a distinct tool
> for confirming remote node availability, though, given that a wide
> range of tools can encounter the same problem under certain
> circumstances. It may not happen, though, simply because a tunable
> script that filters nodes by availability is possible.
>
> As an example, here's a Test-IPNode.ps1 script I use. The script reads
> system IDs (IP/DNS/WINS style names) from the input stream and drops
> any that don't have perfect responses. A more full-featured version
> can be made that allows you to control timeouts, number and size of
> packets, and so on.
>
> #Test-IPNode.ps1
> process {
> $_ | Where {(Get-WmiObject Win32_PingStatus `
> -Filter "address='$_'" `
> ).StatusCode -eq 0}
> }
> I haven't checked the available community extensions lately, but it's
> possible someone has already wrapped up the PingStatus functionality
> in a cmdlet.
>
> "Shay Levi" <no@xxxxxx> wrote in message
> news:89228ed2291668ca7e5d6b545244@xxxxxx
>
Quote:

>> Get-WmiObject is one of the most used cmdlets in PowerShell,
>> sometimes WMI is the only way to get/make system configuration
>> changes on remote computers. It is considered a best practice to
>> verify remote computers availability before trying to connect them.
>>
>> Given that, it is up to the user/scripter to write that
>> functionality, ping remote computer(s), filter the ones that are not
>> available, etc.
>>
>> Wouldn't it be nice to have a -ping switch parameter?
>> ---
>> Shay Levi
>> $cript Fanatic
>> http://scriptolog.blogspot.com

Old 05-12-2008   #4 (permalink)
Alex K. Angelopoulos
Guest


 

Re: [SUGGESTION] New switch parameter for Get-WmiObject

Dealing with the second point first, it's part of the lifecycle process.
There are all sorts of posts about technically exciting things that those of
us who want to dig into odd bits just love. What you're talking about is
more humdrum, but it's actually a very significant part of long-term
real-world usability. Virtually every network administration script needs to
do this kind of thing. So the "interesting" doesn't matter so much; it's
valuable, which is much more important.

"Shay Levi" <no@xxxxxx> wrote in message
news:89228ed22b1338ca8229fde7e08c@xxxxxx
Quote:

> Hi Alex,
>
> I've blogged a solution before (using filters), but wondered if such
> built-in functionality can help.
> You're the only one who reponded to this thread so I guess no one is realy
> interested (or finds it useable)
>
> ---
> Shay Levi
> $cript Fanatic
> http://scriptolog.blogspot.com
>
Quote:

>> That really _is_ one of the frustrating problems with remote access
>> problems. I think it may make more sense to provide a distinct tool
>> for confirming remote node availability, though, given that a wide
>> range of tools can encounter the same problem under certain
>> circumstances. It may not happen, though, simply because a tunable
>> script that filters nodes by availability is possible.
>>
>> As an example, here's a Test-IPNode.ps1 script I use. The script reads
>> system IDs (IP/DNS/WINS style names) from the input stream and drops
>> any that don't have perfect responses. A more full-featured version
>> can be made that allows you to control timeouts, number and size of
>> packets, and so on.
>>
>> #Test-IPNode.ps1
>> process {
>> $_ | Where {(Get-WmiObject Win32_PingStatus `
>> -Filter "address='$_'" `
>> ).StatusCode -eq 0}
>> }
>> I haven't checked the available community extensions lately, but it's
>> possible someone has already wrapped up the PingStatus functionality
>> in a cmdlet.
>>
>> "Shay Levi" <no@xxxxxx> wrote in message
>> news:89228ed2291668ca7e5d6b545244@xxxxxx
>>
Quote:

>>> Get-WmiObject is one of the most used cmdlets in PowerShell,
>>> sometimes WMI is the only way to get/make system configuration
>>> changes on remote computers. It is considered a best practice to
>>> verify remote computers availability before trying to connect them.
>>>
>>> Given that, it is up to the user/scripter to write that
>>> functionality, ping remote computer(s), filter the ones that are not
>>> available, etc.
>>>
>>> Wouldn't it be nice to have a -ping switch parameter?
>>> ---
>>> Shay Levi
>>> $cript Fanatic
>>> http://scriptolog.blogspot.com
>
>
Old 05-12-2008   #5 (permalink)
Marco Shaw [MVP]
Guest


 

Re: [SUGGESTION] New switch parameter for Get-WmiObject

Shay Levi wrote:
Quote:

> Hi Alex,
>
> I've blogged a solution before (using filters), but wondered if such
> built-in functionality can help.
> You're the only one who reponded to this thread so I guess no one is
> realy interested (or finds it useable)
Putting my hand up too...

You should post on connect and provide a link here. That's one way to
get the ball rolling on this.

Marco


--
Microsoft MVP - Windows PowerShell
http://www.microsoft.com/mvp

PowerGadgets MVP
http://www.powergadgets.com/mvp

Blog:
http://marcoshaw.blogspot.com
Old 05-12-2008   #6 (permalink)
Alex K. Angelopoulos
Guest


 

Re: [SUGGESTION] New switch parameter for Get-WmiObject

"Shay Levi" <no@xxxxxx> wrote in message
news:89228ed22b1338ca8229fde7e08c@xxxxxx
Quote:

> Hi Alex,
>
> I've blogged a solution before (using filters), but wondered if such
> built-in functionality can help.
I haven't found your blog on it - you actually have some other interesting
stuff that sidetracked me - but here's the longer, more complete ping script
I wrote a while back that tries to be a complete wrapper for this kind of
functionality. Can you post the specific link if you have it handy?

Although I instinctively think of pinging as something that should be
available separately, I can see a good point to what you're saying after
reflecting on it. I think some kind of FailFast parameter would make sense
for remote calls from Get-WmiObject; it's so common a problem that having
the cmdlet quit trying after a specified period of time would be useful.

By the way, here's a longer script that I wrote as a more full-fledged
wrapper for Win32_PingStatus. It's a bit ugly - only takes values as
arguments, and parameters use the names for Win32_PingStatus properties with
no thought given to making them more PS-like. However, it gives you complete
control over all aspects of the ping, and via the SourceNode you can even
perform a remote ping, running the ping _from_ SourceNode instead of the
local computer. That functionality has been there in Win32_PingStatus
forever, but most people don't notice it, and the first admins I showed it
to were so excited that I could almost see their tails wagging. ; )

Old 05-12-2008   #7 (permalink)
Brandon [MVP]
Guest


 

Re: [SUGGESTION] New switch parameter for Get-WmiObject

This issue is already on connect (I believe) and has been discussed with
Devs as well.

We will just have to wait and see what comes of the conversation.

"Shay Levi" <no@xxxxxx> wrote in message
news:89228ed22b1948ca82641d16c325@xxxxxx
Quote:

>
> Yup... I wanted to read what other people think before opening a new
> suggestion on connect.
>
> 10x
>
>
> ---
> Shay Levi
> $cript Fanatic
> http://scriptolog.blogspot.com
>
Quote:

>> Shay Levi wrote:
>>
Quote:

>>> Hi Alex,
>>>
>>> I've blogged a solution before (using filters), but wondered if such
>>> built-in functionality can help.
>>> You're the only one who reponded to this thread so I guess no one is
>>> realy interested (or finds it useable)
>> Putting my hand up too...
>>
>> You should post on connect and provide a link here. That's one way to
>> get the ball rolling on this.
>>
>> Marco
>>
>> PowerGadgets MVP
>> http://www.powergadgets.com/mvp
>> Blog:
>> http://marcoshaw.blogspot.com
>
>
Old 05-12-2008   #8 (permalink)
Shay Levi
Guest


 

Re: [SUGGESTION] New switch parameter for Get-WmiObject


Yup... I wanted to read what other people think before opening a new suggestion
on connect.

10x


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

> Shay Levi wrote:
>
Quote:

>> Hi Alex,
>>
>> I've blogged a solution before (using filters), but wondered if such
>> built-in functionality can help.
>> You're the only one who reponded to this thread so I guess no one is
>> realy interested (or finds it useable)
> Putting my hand up too...
>
> You should post on connect and provide a link here. That's one way to
> get the ball rolling on this.
>
> Marco
>
> PowerGadgets MVP
> http://www.powergadgets.com/mvp
> Blog:
> http://marcoshaw.blogspot.com

Old 05-12-2008   #9 (permalink)
Alex K. Angelopoulos
Guest


 

Re: [SUGGESTION] New switch parameter for Get-WmiObject

Nice. I've been away from the community (and .NET) for over a year and
hadn't even seen anyone using the System.Net.NetworkInformation.Ping class
before. I didn't even know it was there!

"Shay Levi" <no@xxxxxx> wrote in message
news:89228ed22b1c38ca8265b339fd7e@xxxxxx
Quote:

>
Quote:

>> I haven't found your blog on it
>
> http://scriptolog.blogspot.com/2007/...d-with-ip.html
>
>
> ---
> Shay Levi
> $cript Fanatic
> http://scriptolog.blogspot.com
>
Quote:

>> "Shay Levi" <no@xxxxxx> wrote in message
>> news:89228ed22b1338ca8229fde7e08c@xxxxxx
>>
Quote:

>>> Hi Alex,
>>>
>>> I've blogged a solution before (using filters), but wondered if such
>>> built-in functionality can help.
>>>
>> I haven't found your blog on it - you actually have some other
>> interesting stuff that sidetracked me - but here's the longer, more
>> complete ping script I wrote a while back that tries to be a complete
>> wrapper for this kind of functionality. Can you post the specific link
>> if you have it handy?
>>
>> Although I instinctively think of pinging as something that should be
>> available separately, I can see a good point to what you're saying
>> after reflecting on it. I think some kind of FailFast parameter would
>> make sense for remote calls from Get-WmiObject; it's so common a
>> problem that having the cmdlet quit trying after a specified period of
>> time would be useful.
>>
>> By the way, here's a longer script that I wrote as a more full-fledged
>> wrapper for Win32_PingStatus. It's a bit ugly - only takes values as
>> arguments, and parameters use the names for Win32_PingStatus
>> properties with no thought given to making them more PS-like. However,
>> it gives you complete control over all aspects of the ping, and via
>> the SourceNode you can even perform a remote ping, running the ping
>> _from_ SourceNode instead of the local computer. That functionality
>> has been there in Win32_PingStatus forever, but most people don't
>> notice it, and the first admins I showed it to were so excited that I
>> could almost see their tails wagging. ; )
>>
>
>
Old 05-12-2008   #10 (permalink)
Shay Levi
Guest


 

Re: [SUGGESTION] New switch parameter for Get-WmiObject

Quote:

> I haven't found your blog on it
http://scriptolog.blogspot.com/2007/...d-with-ip.html


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

> "Shay Levi" <no@xxxxxx> wrote in message
> news:89228ed22b1338ca8229fde7e08c@xxxxxx
>
Quote:

>> Hi Alex,
>>
>> I've blogged a solution before (using filters), but wondered if such
>> built-in functionality can help.
>>
> I haven't found your blog on it - you actually have some other
> interesting stuff that sidetracked me - but here's the longer, more
> complete ping script I wrote a while back that tries to be a complete
> wrapper for this kind of functionality. Can you post the specific link
> if you have it handy?
>
> Although I instinctively think of pinging as something that should be
> available separately, I can see a good point to what you're saying
> after reflecting on it. I think some kind of FailFast parameter would
> make sense for remote calls from Get-WmiObject; it's so common a
> problem that having the cmdlet quit trying after a specified period of
> time would be useful.
>
> By the way, here's a longer script that I wrote as a more full-fledged
> wrapper for Win32_PingStatus. It's a bit ugly - only takes values as
> arguments, and parameters use the names for Win32_PingStatus
> properties with no thought given to making them more PS-like. However,
> it gives you complete control over all aspects of the ping, and via
> the SourceNode you can even perform a remote ping, running the ping
> _from_ SourceNode instead of the local computer. That functionality
> has been there in Win32_PingStatus forever, but most people don't
> notice it, and the first admins I showed it to were so excited that I
> could almost see their tails wagging. ; )
>

Closed Thread

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Suggestion: Help as alternate name for '?' universal parameter Alex K. Angelopoulos [MVP] PowerShell 7 06-23-2006 01:15 PM
Suggestion: Universal Usage/Syntax/Definition parameter Alex K. Angelopoulos [MVP] PowerShell 2 06-22-2006 11:42 PM
Suggestion: Get-WmiObject reading computer names from input stream Alex K. Angelopoulos [MVP] PowerShell 2 06-22-2006 11:31 PM
Suggestion: Format-Table's HideTableHeaders parameter should be NoLabel Alex K. Angelopoulos [MVP] PowerShell 0 06-20-2006 06:35 AM
get-WmiObject -Query parameter /\\/\\o\\/\\/ PowerShell 0 05-25-2006 01:03 PM








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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 <