Windows PowerShell 2.0 Cmdlets
PowerShell 1.0 has about 125 cmdlets, whereas v 2.0 has a minimum of 230. The precise number depends on whether you are running Windows 8, 7, or XP.
- PowerShell ISE (Integrated Scripting GUI) makes scripting easier.
- Remoting is the killer new feature of version 2.0
- Background Jobs
- Remote Eventlog a big area of improvement.
- Get-WinEvent also other new ‘event’ cmdlets
- Measure-Object
- Test-Connection is PowerShell’s improvement upon Ping.
- Test-Path Is a cmdlet which I don’t recall seeing in PowerShell 1.0.
- Get-Help’s -online parameter. Checks for any updates.
- PowerShell 5.0 New Features
♣
PowerShell Transactions
On Vista and later on operating systems PowerShell supports database style ‘ACID’ transactions, whereby you can commit or roll-back a sequence of operations.
PowerShell Modules
Import-Module loads a bunch of dll and scripts, it replaces the Add-PSSnapin. See more about the PowerShell modules directory.
#REQUIRES -Version 2.0
This is not merely a remark, but an instruction to PowerShell v 1.0 that it cannot run the code which follows.
# PowerShell 2.0 Requires Example
# Requires -Version 2.0
Enter-PSSession IpAddress or FQDM
Research Techniques for Finding New PowerShell 2.0 Cmdlets
One way of checking for new PowerShell 2.0 cmdlets is to use Get-Command with the -Noun or -verb parameter. For example, I heard a rumour there was a new cmdlet to measure.
Research Measure-Object
# Research measure cmdlets
Clear-Host
Get-Command -verb measure
CommandType Name
———– —-
Cmdlet Measure-Command
Cmdlet Measure-Object
Research New Event cmdlets
# Research new event Windows PowerShell 2.0 cmdlets
Clear-Host
Get-Command -commandType cmdlet *Event*
Note 1: Get-WinEvent looks interesting.
List All Cmdlets
# Research new Windows PowerShell 2.0 cmdlets
Clear-Host
Get-Command -CommandType Cmdlet
Guy Recommends: A Free Trial of the Network Performance Monitor (NPM) v11.5
SolarWinds’ Network Performance Monitor will help you discover what’s happening on your network. This utility will also guide you through troubleshooting; the dashboard will indicate whether the root cause is a broken link, faulty equipment or resource overload.
What I like best is the way NPM suggests solutions to network problems. Its also has the ability to monitor the health of individual VMware virtual machines. If you are interested in troubleshooting, and creating network maps, then I recommend that you try NPM now.
Download a free trial of Solarwinds’ Network Performance Monitor
General Advice For PowerShell 2.0 and 1.0.
Four Reasons to Learn Windows PowerShell
- Think of learning PowerShell as a more convenient method of configuring the server than using the corresponding GUI. I can foresee running PowerShell scripts that will diagnose server problems. With PowerShell you can run queries that are not possible from the GUI. On a good day such a script would even cure the problem – magic!
To come back down to earth, let us start with a trivial example to illustrate the capability of PowerShell. As you may know, the Task Manager will display all the processes, yet with PowerShell you can not only list all processes, but also group them by company (Microsoft, HP and Roxio). All you need is this one-liner:
Get-Process | group-Object company - PowerShell will achieve the same results as VBScript, but with fewer commands. For instance, PowerShell makes scripting WMI much easier, for example, try: Get-WmiObject win32_BIOS. More good news, you can even use PowerShell to replace VBScript for Active Directory scripts.
- I have a sense that there is a changing of the guard; out with old CMD commands, and in with new PowerShell language. More importantly, the new PowerShell language will give you command line control of the Windows operating system; this is similar to the power that Bash commands exert over the UNIX operating system.
In a nutshell: PowerShell really is the way of the future.
- The main reason for learning PowerShell is so that you can administer Exchange Server 2007, and also the Longhorn server that will succeed Windows Server 2003. Microsoft’s thinking is that the point has arrived where complex products like Exchange and Longhorn have so many menus and sub-menus to configure via a GUI, that we need an alternative. Hence the easy-to-use scripting language called PowerShell.
Note: Existing Windows executables, such as Ipconfig and ping, perform in the PS Shell just as they do in the old CMD ‘DOS box’.
SolarWinds Firewall Browser
Here is an utility where you can review firewall settings such as access control lists (ACL), or troubleshoot problems with network address translation (NAT).
Other reasons to download this SolarWinds Firewall Browser include managing requests to change your firewall settings, testing firewall rules before you go live, and querying settings with the browser’s powerful search options.
Guy recommends that you download a copy of the SolarWinds free Firewall Browser.
Simple PowerShell Examples
Preamble, Start, Run PowerShell.
At the command line type (In that dark blue shell):
Get-Service
Here is another example, type:
Get-WmiObject win32_computersystem
I first realised the ability of PowerShell when I saw three lines of PowerShell replace about twenty lines of VBScript. The task is to interrogate Win32_classes, we can either use the traditional VBScript and WMI, or the new PowerShell with its Verb-Noun commands.
VBScript | Windows PowerShell |
‘ Memory.vbs WScript.Quit ‘ End of Sample Memory WMI / VBScript | # Windows PowerShell script "System Name = " + $CompSys.name
|
Summary of What’s New In Windows PowerShell v 2.0
Remoting is the big new feature of PowerShell v 2.0 followed closely by the ISE which makes writing scripts so much easier. Other than that, there lots of neat extra cmdlets.
If you like this page then please share it with your friends
See more Windows PowerShell sections
• PowerShell Home • Introduction • Dreams • 3 Key Commands • Free Permissions Analyzer
• PowerShell Real-life Examples • PowerShell Techniques • PowerShell Syntax • Contact
• PowerShell ISE • PowerShell 2.0 • PowerShell v 3.0 • PowerShell v 4.0 • PowerShell v 4.0
Please email me if you have a better example script. Also please report any factual mistakes, grammatical errors or broken links, I will be happy to correct the fault.