Shortcut Menu

Skip

Main Navigation

Choose your language

You are here:

ActiveXperts.com > Administration > Powershell

ActiveXperts Network Monitor ships with a large collection of PowerShell scripts and VBScript scripts to monitor and manage a network.

Use ActiveXperts Netork Monitor to monitor your virtualization servers, domains, computers and devices. It runs on a single Windows server, without agents required on the monitored systems. It has many built-in checks and also allows administrators to create custom checks using PowerShell, VBScript, WMI and SSH.


Powershell

Introduction

Windows PowerShell is an extensible command-line shell and associated scripting language from Microsoft Corporation.

Windows PowerShell integrates with the Microsoft .NET Framework and provides an environment to perform administrative tasks by execution of cmdlets (pronounced commandlets), which are specialized .NET classes implementing a particular operation; scripts, which are compositions of cmdlets along with imperative logic; executables, which are standalone applications; or by instantiating regular .NET classes. These work by accessing data in different data stores, like the filesystem or registry, which are made available to the PowerShell runtime via Windows PowerShell providers.

Windows PowerShell also provides a hosting mechanism with which the Windows PowerShell runtime can be embedded inside other applications, which can then leverage Windows PowerShell functionality to implement certain operations, including those exposed via the graphical interface. This capability has been utilized by Microsoft Exchange Server 2007 to expose its management functionality as PowerShell cmdlets and providers and implement the graphical management tools as PowerShell hosts which invoke the necessary cmdlets. Other Microsoft applications including Microsoft SQL Server 2008 also expose their management interface via PowerShell cmdlets. In the future, graphical interface-based management applications on Windows will be layered on top of Windows PowerShell. Windows PowerShell includes its own extensive, console-based help, reminiscent of man pages in Unix shells via the Get-Help cmdlet.

In less words, Powershell is the enhancement scripting language of what VBScript has been until now on Windows platforms.

Click here to view a list of Powershell scripts included in ActiveXperts Network Monitor.

There are two Windows PowerShell versions available:

Since version 7.2 ActiveXperts Network Monitor includes Powershell checks. In order to run those scripts you need to have Powershell installed on the machine where Network Monitor is installed.

In order to run scripts on the machine where Windows Powershell is installed, you have to setup the security restrictions. Using the following command, will allow all scripts to be runned:

PS C:\>Set-ExecutionPolicy unrestricted

 

Windows PowerShell 1.0

Powershell 1.0 was released in 2006 and is available for:

  • Windows XP (SP2/SP3);
  • Windows Server 2003;
  • Windows Vista;
  • Windows Server 2008 (available as an optional feature);

Click here to see the list of Windows Powershell 1.0 CmdLets


 

Windows PowerShell 2.0

Powershell 2.0 was released in 2009 and is available for:

  • Windows XP SP3 (will be available as a separate download);
  • Windows Server 2003 SP2 (will be available as a separate download);
  • Windows Vista SP1 (will be available as a separate download);
  • Windows Server 2008 (will be available as a separate download);
  • Windows Server 2008 R2 (included)
  • Windows 7 (included)

Click here to see the list of Windows Powershell 2.0 CmdLets

What's new in Powershell 2.0

Advanced Functions

  • Parameter parsing & binding
       
    • Mandatory
    • Position
    • ValueFromPipeline
    • ValueFromPipelineByPropertyName
    • ValueFromRemainingArguments
  • Parameter validation
       
    • IsNull
    • IsNotNull
    • Set
    • Range
    • Count
    • RegEx Pattern
    • Script
  • Parameter Sets
  • CmdletBinding Support
       
    • SupportsShouldProcess
    • ConfirmImpact
    • DefaultParameterSetName
  • Dynamic parameters

Modules

Modules allow script developers and administrators to partition and organize their Windows PowerShell code in self-contained, reusable units. Code from a module executes in its own self-contained context and does not affect the state outside of the module. Modules also enable you to define a restricted runspace environment by using a script.

  • XCopy deploy (PSModulePath)
  • Module manifests use .psd1 extension
  • Script Modules use .psm1 extension
  • Organization
  • Private variables and functions
  • Import modules easily, (and remove)
  • Related Cmdlets:
       
    • Get-Module
    • New-Module
    • Import-Module
    • Remove-Module
    • Export-ModuleMember

Help

  • XML-based help (just like cmdlets)
  • Comment-based help
    • Comment-Based Help Example
      <#
      .SYNOPSIS
      A short description of the function.
      .DESCRIPTION
      A longer description of the function.
      .PARAMETER 
      The documentation for that specific parameter
      .EXAMPLE
      C:\PS> some example code
      .LINK
      Get-AnotherFunction
      .LINK
      http://yourwebsite.com/help/documentation
      #>
      
    • Comment-Based Help Keywords
         
      • Synopsis
      • Description
      • Parameter
      • Example
      • Inputs
      • Outputs
      • Notes
      • Component
      • Role
      • Functionality
      • ForwardHelpTargetName
      • ForwardHelpCategory
      • RemoteHelpRunspace
      • Link
      • ExternalHelp
  • Online help
  • Provider-based help additions
  • Get-Help now searches! o e.g.: man hashtable

Remoting

  • Fan-in and Fan-out remoting
  • Requires PowerShell 2.0 on both ends
  • Receive serialized property bags, not live objects
  • WinRM = WS-Management = SOAP spec
  • Enable-PSRemoting requires elevation
  • Related Cmdlets:
       
    • New-PsSession
    • Get-PsSession
    • Remove-PsSession
    • Export-PsSession
    • Import-PsSession
    • Enter-PsSession
    • Exit-PsSession
    • Invoke-Command

Eventing

Finally provides support for asynchronous Events, for GUIs, timers, WMI, and remoting

  • Events can be forwarded from remote sessions
  • Related Cmdlets:
    • Register-EngineEvent
    • Register-ObjectEvent
    • Register-WmiEvent
    • RegisterUnregister-Event
    • Get-EventSubscribers
    • New-Event
    • Get-Event
    • Wait-Event
    • Remove-Event

ISE - Integrated Scripting Editor

Integrated Scripting Environment (ISE) is a host application for Windows PowerShell, in it you can run commands and write, test, and debug scripts in a single Windows-based graphic user interface with multiline editing, tab completion, syntax coloring, selective execution, context-sensitive help, and support for right-to-left languages. You can use menu items and keyboard shortcuts to perform many of the same tasks that you would perform in the Windows PowerShell console. For example, when you debug a script in the Windows PowerShell ISE, to set a line breakpoint in a script, right-click the line of code, and then click Toggle Breakpoint.

Transaction support

  • Commit/rollback semantics
  • Rollback can be automatic (if error occurs)
  • Registry provider is only supporter in the box
  • Related Cmdlets:
       
    • Start-Transaction
    • Complete-Transaction
    • Undo-Transaction
    • Get-Transaction
    • Use-Transaction