Showing archive results for 2009

Apr 6, 2009
Post comments count0
Post likes count0

Checking for bound parameters

PowerShell Team

I recently read an email where someone was asking how they could check in their function if a value had been provided to one of the parameters.  Consider for example,     The usual way I’ve seen people deal this problem is by providing a default value which gets assigned to $x in the case that a value wasn’t provided by the caller a...

Apr 2, 2009
Post comments count0
Post likes count0

Setting Network Location to Private

PowerShell Team

The Network Location feature was introduced in Windows Vista. It provides an easy way to customize your firewall settings based on whether you trust or don’t trust the computers around you. There are three Network Location types - Private, Public and Domain. If your computer is a member of the domain then you won’t be able to change the Network Loc...

Apr 2, 2009
Post comments count0
Post likes count0

Many² ways you can set a variable value

PowerShell Team

There are many ways to set a variable's value. I just learnt one more yesterday. If you have others, please add comments # Simple# $ gets the variable, and = will assign it$a = 1 # With Variable Scope# The prepend is the scope, and could be global, script, and others# Useful when you want to keep things in script scope, or share them out in global ...

LANGUAGEFun & Games
Mar 30, 2009
Post comments count2
Post likes count0

Image Manipulation in PowerShell

PowerShell Team

The other week, I showed a Get-ProgID function that I used to help someone at Microsoft Research find a good object to talk to images.  A few comments jumped to one of the possible solutions, which is to use the .NET Drawing assembly (which I have to load first).  I wanted to be reasonably sure that the way to get at the image metadata wa...

CTP3Advanced Functions
Mar 30, 2009
Post comments count0
Post likes count0

Active Directory Administrative Center for Windows Server 2008 R2 implemented using ADPowershell!

PowerShell Team

Windows Server 2008 R2 doesn’t just add ADPowershell – it also adds Active Directory Administrative Center (or ADAC), a new GUI tool for AD administrators.  Read about it on TechNet.  What’s more, while you can’t tell just from looking at it, ADAC is implemented entirely over Windows PowerShell 2.0 and ADPowershell!  Every read and w...

Active Directory
Mar 27, 2009
Post comments count0
Post likes count0

Get closure with GetNewClosure

PowerShell Team

Have you ever created scriptblocks on the fly, say in a foreach loop, and they totally mess up because they all have the same value? This is something sort of advanced, and typically used when you’re proxying an object. The most basic example would be, taken from (http://www.powershellcommunity.org/Forums/tabid/54/aff/1/aft/2506/afv/topic/Default.a...

CTP3Advanced FunctionsScriptBlock
Mar 26, 2009
Post comments count0
Post likes count0

Tied Variables in PowerShell

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
Mar 20, 2009
Post comments count0
Post likes count0

Get-ProgID

PowerShell Team

The other day, a friend over in Microsoft Research wanted to figure out how to get out the width and height of an image in PowerShell.  There are many ways that you can approach this particular problem.  I knew three right off of the top of my head, but none of them had a really optimal experience. I knew there had to be a ...

Mar 20, 2009
Post comments count0
Post likes count0

Active Directory Powershell Blog

PowerShell Team

AD team has started a new blog for their PowerShell Cmdlets.. In their own words "We are here to answer any questions about AD Powershell, share some tips and tricks, discuss the history behind certain decisions and features and hear your feedback on improving AD Powershell experience" Check this out http://blogs.msdn.com/adpowershell/  Osama ...

Active Directory
Mar 16, 2009
Post comments count0
Post likes count0

Local Boy Makes Good

PowerShell Team

Check it out:  http://www.microsoft.com/presspass/exec/de/snover/default.mspx One of the biggest Snoopy Dance moments of my life!   BTW - this is really a reflection of how important Microsoft views PowerShell. I'd love to say more but I've got some Snoopy Dancing to do.   Experiment! Enjoy! Engage! Jeffrey Snover [MSFT] Wi...