Showing results for January 2007 - Page 2 of 4 - PowerShell Team

Jan 23, 2007
0
0

Array Literals In PowerShell

PowerShell Team
PowerShell Team

The first thing to understand is that there are no array literals in PowerShell J Arrays are built using operators or casts. The way to build an array in PowerShell is to use the comma operator as shown in the following examples:  $a = , 1          # array of one element $a = 1,2          # array of two elements $a = 1,2,3        # array of three ...

Jan 23, 2007
0
0

How to create enum in PowerShell?

PowerShell Team
PowerShell Team

[Updated to comply with the naming guidelines (create=>new)] Dynamic assembly emitting techniques can be used to create new classes or data types in PowerShell. Trick is that right permission needs to be set so that data types created in dynamic assembly can be used subsequently. Following is an example for creating a new enum ty...

Jan 23, 2007
0
0

Channel 9 Chat with Scott Hanselman

PowerShell Team
PowerShell Team

A while ago I had the great pleasure to interview Scott Hanselman for Channel 9.about a wide range of topics. It was a blast. Think of it as the geek equivalent of My Dinner with Andre. Ok well neither of us are as interesting as that but Scott comes close (and I did get to drop a reference to Kierkegaard which always brightens my day). If you ...

Jan 17, 2007
0
0

IPCONFIG/All

PowerShell Team
PowerShell Team

While using CMD.exe, I got into a number of bad habits. One of those is the habit of eliminating whitespace for various commands. The problem is that that causes problems with PowerShell. More precisely stated – it doesn't work. Here is what you get: PS> ipconfig/allThe term 'ipconfig/all' is not recognized as a cmdlet, function, operable pr...

Jan 17, 2007
0
0

PowerShell Analyzer: The Video

PowerShell Team
PowerShell Team

If you haven't already installed PowerShell analyzer, you can now check out want it does by watching the video. Karl Prosser recently released a 7 minute video showing you a run-through (as opposed to a walk-through) of its features. Now that fact that he spends 7 minutes and has to run through the features should give you a bit of a clue as to ...

Jan 16, 2007
0
0

Custom Alias Listing

PowerShell Team
PowerShell Team

When you run Get-Alias, it shows you all the aliases currently available. You might want to know which aliases were Custom aliases. That is to say, which aliases did not come built in with PowerShell. So what does it take to answer this question? With those 4 things in focus, you can answer the question: PS> Compare-Object (Get-Alias) (PowerS...

Jan 16, 2007
0
0

Managing Processes in PowerShell

PowerShell Team
PowerShell Team

Several people have asked recently about how to manage processes in PowerShell. This blog post should answer a number of those questions. As one might expect from the "shell" part of PowerShell, you don't have to do special anything to start a process . In a programming language such as VBScript, you have to do something fairly complex like: ...

Jan 12, 2007
0
0

Difficulties Reading Our Blog

PowerShell Team
PowerShell Team

Kjartan posted the comment:  I really like reading your blog and have done so for a long time now, but since I mostly read blogs with the RSS-reader in IE7 the styling of the code samples makes the posts harder to read, for some reason IE7 (at least the version I'm using Vista RC1) dispays the styling as a big chunk of text and the ...

Jan 11, 2007
0
0

Set-Alias-Strict

PowerShell Team
PowerShell Team

I picked up Jerry Lee Ford's book Microsoft Windows PowerShell Programming for the absolute beginner .  In the section on aliases, he warns users that Set-Alias does not verify the validity of the alias assignment.  That is a good point.  Here is a function that does that for you.  function Set-Alias-Strict($Name, $Value){...

Jan 11, 2007
0
0

Accessing data past the end of an array

PowerShell Team
PowerShell Team

In the newsgroup Microsoft.Public.Windows.PowerShell  Marco Shaw asked about accessing data past the end of a defined array.  He wondered why he didn't get an error.    As a general rule in PowerShell, when you ask for something that doesn't exist, you get an NULL not an error.  PS> $array=@(0,1,2)PS> if ($ar...