Computer Library windows 2008 exchange server power shell security register

Measure Statistical Properties of a List

1. Problem
You want to measure the numeric (minimum, maximum, sum, average) or textual (characters, words, lines) features of a list of objects.
2. Solution
Use the Measure-Object cmdlet to measure these statistical properties of a list.
To measure the numeric features of a stream of objects, pipe those objects to the Measure-Object cmdlet:
        PS >1..10 | Measure-Object–Average -Sum
        [...]


Use a COM Object

1. Problem
You want to create a COM object to interact with its methods and properties.
2. Solution
Use the New-Object cmdlet (with the –ComObject parameter) to create a COM object from its ProgID. You can then interact with the methods and properties of the COM object as you would any other object in PowerShell.
        $object = New-Object [...]


Create an Instance of a .NET Object

1. Problem
You want to create an instance of a .NET object to interact with its methods and properties.
2. Solution
Use the New-Object cmdlet to create an instance of an object.
To create an instance of an object using its default constructor, use the New-Object cmdlet with the class name as its only parameter:
        PS >$generator = New-Object [...]