Creating a Secure Environment using PowerShell Desired State Configuration

Introduction: Traditionally, IT environments have secured their business critical information against external threats by adding additional layers of security to the org’s network (e.g. firewalls, DMZs, etc.).  However many of today’s attacks are coming from inside the network so a new “assume breach” approach must be adopted. In this blog, we show how to create… Read more

How objects are sent to and from remote sessions

Instead of piping unstructured text, Windows PowerShell pipes objects between commands in a pipeline.  As a consequence PowerShell remoting also deals with objects when passing data to and from remote sessions.  This post explains how remote objects are serialized and which types of objects can be sent with full fidelity.  You might want to refer… Read more

Saving remote session to your local disk

Read the previous post on implict remoting to learn how the Import-PSSession cmdlet makes it easier to work with remote commands by presenting them as if they were local commands. This user experience saves you the trouble of typing long Invoke-Command incantations to pass arguments to remote commands or to download remote help content. The… Read more

Bringing remote commands to your local session

How can you manage multiple technologies installed on separate machines that expose their management surface through cmdlets?  One approach would be to open remote desktop connection to each of those machines, another approach would be to send commands using Invoke-Command and PowerShell Remoting.  But remote desktop is not a feasible solution for automation and invoking… Read more

How to pass arguments for remote commands

When invoking remote commands, one often wants to use local values as arguments to the remote command. This post explains how to do that. Hardcoded values Let’s start with a simple example. Below you can see how Get-Process is invoked in a remote session when the Id parameter is set to 0: PS> $s =… Read more

Advanced Debugging in PowerShell

Here is a collection of tips and tricks to debug PowerShell Read UpThere is a 7-part series of “Debugging Monad Scripts” that Jon Newman wrote a few years ago that covers a lot of tips, including error handling, traps, tracing, and covers a lot of V1 stuff. Clean codeThe best route, is to make sure… Read more

Managing Remote Sessions

  PowerShell V2 introduces a new capability which allows you to remotely manage machines in your organization. You may have already tried this new feature. In this blog, I will show how an administrator can manage different remote sessions (created by different users from different clients) Scenario: Using PowerShell remoting, normal users can perform non-admin… Read more

Interactive remoting in CTP3

Today let’s talk about one of the cool new features of Windows PowerShell V2 – Interactive Remoting. Let’s start with an example: PS> $env:COMPUTERNAME # Check local computer name. VLADIMIA64 PS> Enter-PSSession Vladimia06 # Remote to other computer. [vladimia06]: PS C:\Users\Vladimia\Documents> $env:COMPUTERNAME # Check remote computer name. Vladimia06 [vladimia06]: PS C:\Users\Vladimia\Documents> $PSVersionTable # Check powershell… Read more

Manage winrm settings with wsman provider

PowerShell remoting is built on top of Windows Remote Management (WinRM), which is Microsoft’s implementation of WS-Management protocol. You can use winrm.cmd command line tool to query and manage winrm settings. PowerShell V2 CTP3 contains a wsman provider for you to manage winrm settings with the standard *-Item cmdlets . Let’s try it out: PS… Read more

Configuring PowerShell for Remoting – Part 1

The features discussed in this blog post depend on PowerShell CTP3 release. Details about PowerShell CTP3 can be found at PowerShell v2 introduces a new capability to manage systems in your organization remotely.  We directly support hosting PowerShell in either WinRM service or IIS. In this blog I will talk about WinRM service hosting… Read more