Showing results for Add-Type - PowerShell Team

Mar 26, 2009
0
0

Tied Variables in PowerShell

PowerShell Team
PowerShell Team

With Add-Type and $executioncontext you can add special varibles that have tied values. I made $random, and $now add-type @"using System;using System.Management.Automation;public class RandomVariable : PSVariable{Random r;public RandomVariable ()  : base("Random", 0, ScopedItemOptions.ReadOnly | ScopedItemOptions.AllScope)  {r = new Rand...

CTP3Add-TypeScriptBlock
Jan 2, 2009
0
0

How To Write a Console Application in PowerShell with Add-Type

PowerShell Team
PowerShell Team

Windows PowerShell CTP3 has a lot of very cool things.  CTP2 introduced the Add-Type cmdlet, which allowed you to dynamically compile C# in PowerShell.  It was actually possible to use the CompilerParameters to Add-Type to make a console application, but it wasn't particularly easy.  In CTP3, we've made this a lot easier to do. Ther...

CTP3HowToAdd-Type
Jun 3, 2008
0
0

V2: Custom Enums

PowerShell Team
PowerShell Team

Once again MOW proves what a clever guy he is.  Check out his blog entry PowerShell V2 CTP2: making Custom Enums using Add-Type. He shows how you can make your own enums using a very simple function he wrote (Add-Enum) which leverages our new Add-Type cmdlet.  Wonderful stuff. Add-Type is one of those huge game-changing features that we'v...

Add-Type
Jun 2, 2008
0
0

Show-PowerShell / Hide-PowerShell

PowerShell Team
PowerShell Team

During the Week of WPF, someone requested an example of how to minimize the PowerShell window. Here's a quick module to make it happen.  Copy/paste the code below into Documents\WindowsPowerShell\Packages\PowerShell\PowerShell.psm1 $script:showWindowAsync = Add-Type –memberDefinition @” [DllImport("user32.dll")]...

Add-Type
May 22, 2008
0
0

WPF & PowerShell – Part 1 ( Hello World & Welcome to the Week of WPF )

PowerShell Team
PowerShell Team

Welcome to the Week of WPF.  During the next 7 days, I’ll help show you how you can use WPF and PowerShell together. PowerShell could always script almost everything in .NET, but, prior to the recent CTP2 you could not script Windows Presentation Foundation (WPF) in PowerShell. Now you can script everything that WPF can do within PowerShell. T...

PowerShellWPFAdd-Type