Lesson 1: Getting Started with AppFabric Cmdlets for Windows PowerShell

Time to complete: 15 minutes

Objective: To prepare the Windows PowerShell environment for using the Microsoft AppFabric 1.1 for Windows Server cmdlets for Windows PowerShell to configure, manage, and monitor the Order Service application.

Purpose: In this lesson, you will load the ApplicationServer module for Windows PowerShell and enable script execution for Windows PowerShell. You should use the same Windows PowerShell console for the rest of the lessons in this tutorial.

Prerequisites

Note the following requirements before you begin this step:

  • You must have AppFabric already installed.

  • You must be able to run Windows PowerShell with an administrative account.

Procedure

You will complete the following steps in this lesson:

  1. Start a Windows PowerShell session with administrative credentials.

  2. Enable Windows PowerShell script execution.

  3. Load the ApplicationServer module for Windows PowerShell

Starting a Windows PowerShell Session with Administrative Credentials

  1. Powershell.exe is located in the C:\Windows\System32\WindowsPowerShell\v1.0 directory. Open that directory in Windows Explorer or use the search tool to locate it by clicking Start, and then entering powershell.exe in the search box.

  2. Right-click powershell.exe, and then click Run as administrator.

  3. After the Windows PowerShell window is running for your session, right-click the title bar, and then click properties.

  4. In the “Windows PowerShell” Properties window, make sure QuickEdit Mode is selected, and then click OK.

Enabling Script Execution in Windows PowerShell

The steps in most of this tutorial are oriented toward using a Windows PowerShell session. However, you can use the commands in all of the lessons to build a script for automation. In some lessons script execution is used to simplify the approach. In this section you will enable execution of a local script for this Windows PowerShell session only.

  1. Execute the following command in the Windows PowerShell window to allow local unsigned scripts to run in Windows PowerShell.

    Set-ExecutionPolicy –ExecutionPolicy RemoteSigned –Scope Process
    
  2. When you are prompted to confirm the execution policy change, type Y and then press ENTER.

  3. To help verify that local script execution is now enabled, execute the following command in Windows PowerShell.

    Get-ExecutionPolicy
    

    Windows PowerShell should report the execution policy as RemoteSigned.

The –Scope Process parameter ensures that the policy is active only for the current Windows PowerShell process and any child process that you may create. By setting the Windows PowerShell execution policy to RemoteSigned using the command above, you have activated the following policy for your current Windows PowerShell session:

  • Scripts can run.

  • Requires a digital signature from a trusted publisher on scripts and configuration files that are downloaded from the Internet (including e-mail and instant messaging programs).

  • Does not require digital signatures on scripts that you have run and that you have written on the local computer (not downloaded from the Internet).

To revert this policy change just close the current Windows PowerShell session and any child process you have started with that session. Note that the lessons in this tutorial will require the modified execution policy enabled for the session.

Keep in mind that the execution policy does not prevent any particular commands or cmdlets from being executed. It only sets restrictions on which script and configuration files can be executed.

For more information about execution policies in Windows PowerShell 2.0, see about_execution_policies or execute the following command.

Get-help about_execution_policies

Loading the Windows PowerShell Module for AppFabric

  1. Execute the following command to use the Import-Module cmdlet for Windows PowerShell to load the ApplicationServer module for Windows PowerShell.

    Import-Module ApplicationServer
    

    No errors indicate the module was loaded successfully.

  2. To verify that the ApplicationServer module for Windows PowerShell is properly loaded, execute the following command in the Windows PowerShell window.

    Get-Command –Module ApplicationServer
    

    This result of that command should list in a table format all commands exposed by the ApplicationServer module for Windows PowerShell.

What Did I Just Do?

In this lesson you started Windows PowerShell with administrative credentials to allow script execution in future lessons. You also loaded the ApplicationServer module for Windows PowerShell and verified that the commands were being exposed by the module. You will use these commands in this tutorial to configure, manage, and monitor the Order Service application.

Next Steps

In Lesson 2: Deploying the Order Service Application with Windows PowerShell, you will build and deploy the Order Service projects by using Windows PowerShell.

See Also

Concepts

Lesson 2: Deploying the Order Service Application with Windows PowerShell
Lesson 3: Configuring the Order Service with Windows PowerShell
Lesson 4: Monitoring the Order Service with Windows PowerShell
Lesson 5: Tracking the Workflow with Windows PowerShell

  2012-09-12