Examples of PowerShell Commands
You'll probably find the some PowerShell commands to be more confusing than traditional tools like the command prompt, especially when you first learn the language.
For example, at the command prompt, type "ipconfig" and you see the IP addresses of the computer. However in PowerShell, you must enter the following (see Figure 2):
Get-WmiObject -Class Win32_NetworkAdapterConfiguration -Filter IPEnabled=TRUE
However, PowerShell offers more power. For instance, the following command takes a list of IP addresses/host names, runs a ping on each of them, and returns the values in a nice table, as you see in Figure 3.
"localhost","192.168.2.1","microsoft.com" | ForEach-Object -Process {Get-WmiObject -Class Win32_ PingStatus -Filter ("Address='" + $_ + "'") -ComputerName .} | Select-Object –Property Address,ResponseTime,StatusCode
This command may look daunting and not practical for quick pinging, but it's great to include in a script.
It shows just how much you can do with PowerShell. You can basically write programs.