PowerShell Team
Automating the world one-liner at a time…
Latest posts

15 Minutes with Lang.Net

Microsoft is an awesome place to work on languages! Lang.Net is a great language conference that Microsoft holds every year. We bring in people from all around the industry that are passionate about languages and then race through a set of topics. All the talks are given 15 or 30 minute slots so that we can get through a ton of information. Check out the agenda for this year (HERE) to get a flavor for the wide range of topics and attendees. This year I was given 15 minutes to describe PowerShell! I decided to: You can see the presentation HERE. I would highly recommend w...

Increasing visibility of cmdlet design guidelines

Summary In PowerShell v1, we published a set of cmdlet design guidelines that included direction on how to properly name cmdlets. Throughout the v2 cycle, we've seen an increase in cmdlet authors deviating from the standards in unexpected ways. Our user community (you all) has become particularly vocal in recent months that we needed to do something in v2 to curb this trend. This led to a series of discussions on our team about an appropriate course of action for v2. The outcome of those discussions includes changes to Import-Module where we will perform name checking on imported commands. We decided not to disa...

Configuring PowerShell for Remoting – Part 2 (Fan-In)

The features discussed in this blog post depend on PowerShell CTP3 release. Details about PowerShell CTP3 can be found at http://blogs.msdn.com/powershell/archive/2008/12/23/early-christmas-present-from-powershell-team-community-technology-preview-3-ctp3-of-windows-powershell-v2.aspx The Part 1 of this series concentrated on configuring PowerShell remoting through WinRM service. In this blog post, I will talk about configuring PowerShell through IIS, which we call as Fan-In. The WinRM service based PowerShell remoting is targeted for those users who want to administer/manage a machine(s) (or an asset on the mach...

Introducing the WMI Blog

The people over on WMI, WinRM, and BITS have started up a blog to share their systems management expertise with the world. Check it out: http://blogs.msdn.com/wmi/ Here are some fun posts to get you started: Accessing WMI Data via WinRM Let’s Troubleshoot WMI (Part 1: Remoting & Security) (this one includes a handy chart I wrote years ago to figure out what I needed to change when WMI couldn’t connect) Introducing BITS PowerShell Cmdlets Hope this Helps, James Brundage [MSFT]

Checking for bound parameters

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 and then checking for that value. That works in the majority of cases, but let’s say that you wanted to differentiate between a default $null value and $null being passed by the caller. What would you do? If you’re on v2, a simple solution is ...

Setting Network Location to Private

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 Location type. If your computer is standalone or part of the workgroup, then you can choose what type of network location do you want - Public or Private. Private means that you are a member of the trusted network and you can lower your network security a little bit. Publi...

Many² ways you can set a variable value

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 scope$global:a = 1 # Complex variable names# Useful if you have a variable with the name ${Yahoo!Id}${a} = 1 # Using the Set-Variable cmdlet# Useful if you want to indirectly set the value# Has extra parameters like scopeSet-Variable a 1 # Using the variable provider# N...

Image Manipulation in PowerShell

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 was efficient and didn’t require loading up any assemblies PowerShell hadn’t loaded already. Looking at the output of Get-ProgID, Two COM objects jumped out at me: These two COM objects are part of a whole fun family of scriptable COM objects that work with the M...

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

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 write to AD goes through ADPowerShell. So, if you were wondering whether Windows PowerShell and ADPowershell are just for scripters -- they aren’t! Windows PowerShell and ADPowerShell provide a powerful and flexible management API for the construction of mana...