Into to PowerShell – 2 Getting Started with PowerShell

  PowerShell, Programming

Get a list of commands

get-command
  • Commandlets (Cmdlet): Native Powershell commands written in .Net
  • Functions: Written in PowerShell scripting language
  • Help: help <command> <-examples>
  • Aliases: get-alias

PowerShell Run Modes

  • Normal Mode: Ability to run some commands could be limited
  • Administrator Mode: Ability to run any command

Bit Modes

PowerShell & PowerShell ISE = 64 bit
PowerShell x86 & PowerShell ISE x86 = 32 bit

Customize: Click PowerShell Icon in top left

Run Historical Commands

  • get-history: view previous commands
  • invoke-history <command number> <; next command number>
  • clear-history: delete history log
    • This does not remove them from the up/down arrow access
    • press <Alt>S+<Alt>M to create a new session to completely remove the history
      • History only lasts as long as the session lasts.

Auto Complete

  • Start entering and press [Tab] to complete
  • [Shift]+[Tab] cycles backwards

Services

  • View running services: get-service
  • View a specific service: get-service -Name <Service Name>
    • Hint: Pressing [Tab] after ‘-‘ will default to ‘Name’
  • Start a service: start-service -Name <Service Name>

 

PowerShell ISE

PowerShell script extensions are always .ps1

 

LEAVE A COMMENT