Enabling Powershell


For using PowerShell in Applications Manager, you need Windows Management Framework (Windows PowerShell 2.0 and WinRM 2.0) on both Applications Manager server and the remote Windows server. For more details refer http://support.microsoft.com/kb/968929.

Enable and Use Remote Commands in Windows PowerShell

Ensure that Windows PowerShell is enabled in both servers:

  • Open Control Panel.
  • Select Programs and Features.
  • In the Tasks list, click Turn Windows features on or off.
  • When the Server Manager console opens, check if Windows PowerShell is enabled

You can verify the availability of Windows Remote Management (WinRM) service and configure PowerShell for remoting by following these steps:

  • Start Windows PowerShell as an administrator by right-clicking the Windows PowerShell shortcut and selecting Run As Administrator.
  • To configure Windows PowerShell for remoting, type the following command : Enable-PSRemoting -force
  • Configure the TrustedHosts setting on both computers, so that computers will trust each other:
    On Remote Monitored Server:
    Set-Item wsman:\localhost\client\trustedhosts <Applications Manager hostname>
    On Applications Manager Sever:
    Set-Item wsman:\localhost\client\trustedhosts *
  • Include the below cmdlets to be execute on remote Windows server when enabling powershell remoting (It's not required to be run on the Applications Manager server):
    "Set-Item WSMan:\localhost\Shell\MaxShellsPerUser -value 25 -WarningAction SilentlyContinue" ( To increase the maximum number of concurrent shells that a user can remotely open)
    "Set-Item WSMan:\localhost\Shell\IdleTimeout -value 60000 -WarningAction SilentlyContinue" (Determines how long the session stays open if the remote computer does not receive any communication from the local computer, including the heartbeat signal. When the interval expires, the session closes.)
  • On both computers, restart the Windows Remote Management (WinRM) so the new settings will take effect : Restart-Service WinRM.

You can test the configuration and connection from Applications Manager by following these steps:

  1. Open PowerShell Console with administrator privileges.
  2. Run : $testSession= New-PSSession -ComputerName <REMOTE-HOSTNAME> -Credential Get-Credential
  3. A popup will appear, give the remote server credentials.
  4. If any error is thrown, do the required configuration/setup to resolve it.
  5. If step 3 executes without error, remove the testSession by executing : Get-PSSession | Remove-PSSession

The steps above will test whether the WinRM service is running on the remote computer and if Applications Manager can communicate with the remote server.