The Basics of PowerShell (part 1)

Ok, you're not a programmer, you're a SysAdmin. Your job is to keep things up and running. When something goes down, you need to figure out why so you can get it back up ASAP. With PowerShell at your fingertips, you can accomplish this and become a hero at the same time.

What is PowerShell?

PowerShell is a command-line shell created for system administrators. PowerShell includes an interactive prompt and a scripting environment that can be used independently or in combination. It is built on top of the .NET Framework Common Language Runtime (CLR) and the .NET Framework, and accepts and returns .NET Framework objects. In English, this means you can get the information you need almost instantly using PowerShell, if you know how to ask for it.

ps.png

The Cmdlet

A cmdlet is a simple command that can manipulate objects in PowerShell. Cmdlets have a unique format -- a verb and noun separated by a dash (-), such as Get-Help. You can use each cmdlet separately or in combination to perform complex tasks. PowerShell includes more than one hundred cmdlets, and you can write your own.

Things you should know about PowerShell:

  • PowerShell does not process text. Instead, it processes objects based on the .NET Framework.
  • PowerShell comes with a set of built-in commands with a consistent interface.

PowerShell and SAM: Configuration and Usage

The ability to employ PowerShell scripts within SAM is a powerful advantage for system administrators. In order to use PowerShell with SAM you must have PowerShell 2.0 or later installed on the main Orion server and target servers. PowerShell 2.0 can be found here. After confirming that PowerShell is installed on the servers, ensure that Windows Remote Management (WinRM) is properly configured and enabled on the SAM and target servers. To do this, follow these steps:

1. On the SAM server, open a command prompt as an Administrator. To do this, go to the Start menu and right-click the Cmd.exe and then select Run as Administrator.


2. Enter the following in the command prompt:

    winrm quickconfig –q
    winrm set winrm/config/client @{TrustedHosts="*"}

3. On the target server, open a command prompt as an Administrator and enter the following commands, where IP address is the IP address of your SAM server.:

    winrm quickconfig
    winrm set winrm/config/client @{TrustedHosts="IP_ADDRESS"}

After you successfully complete these steps, PowerShell will be able to properly communicate with SAM. See Configuring and Integrating PowerShell.

In part 2, we'll discuss PowerShell Templates and Monitors.

BTW, check out the new...

FREE REMOTE EXECUTION ENABLER FOR POWERSHELL

SAM_AppBasics_WP.png

Parents
No Data
Comment
  • $core_v2_ui.GetResizedImageHtml($comment.User.AvatarUrl, 44, 44, "%{border='0px', alt=$comment.User.DisplayName, ResizeMethod='ZoomAndCrop'}")
    $core_v2_ui.UserPresence($comment.User.Id) $comment.User.DisplayName
    This comment is under review.
Children
No Data
Thwack - Symbolize TM, R, and C