troubleshooting Question

PowerShell and .NET - Calling Methods

Avatar of Chris Dent
Chris DentFlag for United Kingdom of Great Britain and Northern Ireland asked on
Windows Server 2003Microsoft DevelopmentPowershell
5 Comments1 Solution7816 ViewsLast Modified:

Busily chipping away at understanding PowerShell, but being a complete non-programmer occasionally makes things really odd...

Anyway, perhaps some one already knows this one and I can stop trying to make up reasons.

I really like having access to the .NET Framework, really quite shiny and can do things that were a pain in the proverbial in VbScript. But...

When using classes and their associated methods in the .NET Framework how do you know how to properly call them (in advance, without my usual Trial and Error approach)?

For example, I can call a method in the DNS class like this:


And / Or access the values returned with:


All fine so far, but then I go and pick on another class, we'll take Ping this time, sticking in the networking theme. Because it's somewhat consistent I wanted to do this:


Send being the method under the Ping class that seemed entirely sound. Doesn't work, of course. Instead I have to create an object:

$Ping = New-Object System.Net.NetworkInformation.Ping

So, hmmm, anyone happen to know why? If it's not a horribly long answer involving many concepts that I just don't want to get ;)


Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 5 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros