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 Random();} public override object Value { get
Read More...
Read the complete post at http://blogs.msdn.com/powershell/archive/2009/03/26/tied-variables-in-powershell.aspx
Posted
Mar 26 2009, 05:17 PM
by
Windows PowerShell Blog