Monday, January 20, 2014

Microsoft Virtual Academy: PowerShell M08


To start your own learning check out Microsoft Virtual Academy:
(http://www.microsoftvirtualacademy.com/training-courses/getting-started-with-powershell-3-0-jump-start?o=3276#?fbid=aVs9FfAH2DJ)
(rewritten based on my notes available here: https://drive.google.com/file/d/0B1fwreWrAZioWUlmOXVBYlJEWU0/edit?usp=sharing)

Module 8 "Automation in scale: remoting" consists of 2 video segments totaling ≈ 26 minutes along with a PowerPoint of 9 slides.

Overview:
  • Remoting
  • Sessions
  • Remote CMDLETs
  • Measure execution speed
Remoting

    As covered in past module/posts we can execute CMDLETs on remote systems using the Invoke-Command / ICM.  Somethings to understand about this process.


  • When executed command sent to remote system to establish PowerShell session.
    • Involves creating TCP connection, PowerShell session each time the ICM command is used.
  • This is inefficient for many reasons:
    1. Resources wasted to create and tear down PowerShell session on remote system for each ICM execution
    2. Since each ICM is it's own session nothing remains in memory after tear down.  This causes problems for automation.
To get around the limitations and work more efficiently remote PowerShell sessions are allowed.  It allows the remote start of a PowerShell session that will remain alive until closed. This allows for data to be passed through following CMDLETs.



Sessions

    A PowerShell session allows the execution of CMDLETs and usage of local memory for data/variables.  A session can be created by opening local PowerShell shell or through CMDLET New-PSSession (Sessions can be local or remote).

New-PSSession -Computername [DC1]
     Opens new session with remote system (DC1)

To view current live/open sessions we use the following:
Get-PSSession
 Id       Name            ComputerName    State         ConfigurationName         Availability
 --        ----                  ------------                  -----            -----------------                        ------------
  4       Session4      cutie                        Opened     Microsoft.PowerShell     Available
  5       Cutie             cutie                         Opened     Microsoft.PowerShell     Available


Remote CMDLETS
    
Enabling Remoting


No comments:

Post a Comment