Welcome to MSDN Blogs Sign in | Join | Help

July 2006 - Posts

Why do I sometimes get different types?

PSMDTAG:FAQ: Why do I sometimes get different types or different behaviors? PSMDTAG:FAQ: When I pipe a heterogenous set of objects to an cmdlet that expects a homogenous stream - what happens and why? In our newgroup ( Microsoft.public.Windows.PowerShell
Posted by PowerShellTeam | 1 Comments
Filed under: ,

Suppressing return values in PowerShell functions

PSMDTAG:FAQ: How do I supress return values in PowerShell functions? This was asked in a newgroup with the clarification: What I mean is: When you call a function Foo that returns a bool, PS will write 'True' or 'False' to the screenby default. Is there
Posted by PowerShellTeam | 5 Comments
Filed under:

Creating arbitrary delegates from scriptblocks in PowerShell...

People have been asking about creating arbitrary delegates out of scriptblocks. As Jeffrey has mentioned, this isn't directly supported in V1.0 of PowerShell. It is, however, possible to do it using dynamic methods and the CreateDelegate call. Here's
Posted by PowerShellTeam | 16 Comments

Attachment(s): get-delegate.ps1

Casting a scriptblock to an arbitrary delegate signature

Arild asked the following in http://arildf.spaces.msn.com/blog/cns!E99F8B43533149B0!140.entry?_c%3dBlogPart : PSMDTAG:FAQ: Delegates - how to cast a scriptblock to an arbitrary delegate signature? ANSWER - You can't in V1.0. In version 1.0 Windows PowerShell
Posted by PowerShellTeam | 3 Comments
Filed under: ,

Attachment(s): h.ps1

Issues with Windows PowerShell syntax

REI recently posted some comments/requests about Windows PowerShell syntax at: http://blogs.msdn.com/powershell/archive/2006/04/25/583273.aspx#675133 Let's go through a few of the points. ...the syntax was just way too cryptic and unintuitive. Often it's
Posted by PowerShellTeam | 21 Comments
Filed under: , ,

Meet the Exchange Superstars!

Now you can meet the superstars (Vivek Sharma and Mihai Jalobeanu) behind the Exchange Management Shell in a video interview at: http://msexchangeteam.com/archive/2006/07/20/428366.aspx You can also get a demo of the Exchange Management Shell (which is

Setting the console title to be your current working directory

jmanning wrote: Also, given how common the request is, I'd ask Jeffrey to (pretty-please) also include in this post a prompt function that sets the title to include pwd. Ask and yea shall receive: function Prompt { $host.ui.RawUI.WindowTitle = $(get-location)
Posted by PowerShellTeam | 2 Comments
Filed under: , ,

How to I set the title of my Console Window?

PSMDTAG:FAQ: H ow do I set the title of my console window? ANSWER: $Host.UI.RawUI.WindowTitle = "PowerShell ROCKS" Jeffrey Snover [MSFT] Windows PowerShell/Aspen Architect Visit the Windows PowerShell Team blog at: http://blogs.msdn.com/PowerShell Visit
Posted by PowerShellTeam | 6 Comments
Filed under:

Exchange Management Shell

Here is a pointer to an Introduction To the Exchange Management Shell: http://download.microsoft.com/download/6/d/4/6d4b5c51-dd72-41d3-b5b1-9dc22b1d35f1/IntroExchangeMgmtShell.pdf This is a nice glossy view of the important aspects of both Windows PowerShell
Posted by PowerShellTeam | 3 Comments
Filed under:

PSMDTAG:FAQ: What is $OFS

In my blog entry regarding Cascading Type Casts ( http://blogs.msdn.com/powershell/archive/2006/07/15/Cascading_Type_Casts.aspx ) there was an example: PS> [string][char[]][int[]][char[]]"PowerShell" P o w e r S h e l l And in a comment was a question
Posted by PowerShellTeam | 0 Comments
Filed under: ,

Variable expansion in strings and here-strings

PSMDTAG:FAQ: What is the difference between single quoted and double quoted strings? ANSWER: Double quoted string expand variables and single quoted strings do not. Example: PS> $x="TEST" PS> "This is a $x" This is a TEST PS> 'This is a $x' This
Posted by PowerShellTeam | 8 Comments
Filed under:

Cascading Type Casts

A user on the newsgroup wondered whether the example below highlighted a bug or a feature. They applied multiple type declarations on a single parameter and Windows PowerShell did not complain. function check { param([string] [int] $y = 0, $x = 0) ###^^^^^^^^^^^^
Posted by PowerShellTeam | 2 Comments
Filed under: ,

HanselMinutes Podcast on Advanced Windows PowerShell

Check out Scott Hanselman's podcast on Advanced Windows PowerShell at: http://hanselminutes.com/default.aspx?showID=33 Scott really "gets" PowerShell and has a fantastic way of communicating it. With V1.0, Windows PowerShell delivers a VERY powerful engine

Indirectly Invoking Methods Via Variablenames

PSMDTAG:FAQ: Can I specify a methodname using a variable? e.g. $x.$y() PSMDTAG:FAQ: Why do I get METHOD metadata when I specify a method without providing parentheses? One of the great things about Windows PowerShell is that it is a latebound language
Posted by PowerShellTeam | 3 Comments
Filed under: , ,

Type Shortcuts

PSMDTAG:FAQ: What is a TYPE SHORTCUT? PSMDTAG:FAQ: What are the TYPE SHORTCUTS? Type shortcuts are a Windows PowerShell feature that allows you to reduce the amount of typing you have to do when specifying a type. For example, the following 2 statements
Posted by PowerShellTeam | 5 Comments
Filed under: , ,

Are ScriptBlock parameters implemented for functions?

PSMDTAG:FAQ: Are ScriptBlock parameters implemented for functions? Not in V1. Functions do not use the same parameter binding mechanism as Cmdlets. This is something we intent to address in a future release. -- Jeffrey Snover [MSFT] Windows PowerShell
Posted by PowerShellTeam | 0 Comments
Filed under: ,

Revisiting: Listing all the COM automation PROGIDs

In the blog entry Listing all the COM automation PROGIDs http://blogs.msdn.com/powershell/archive/2006/06/29/650913.aspx . I showed how you could use the registry to get all the progids that you can use for COM automation. Here is a way to do the same
Posted by PowerShellTeam | 3 Comments
Filed under: , ,

How can a script tell what directory it was run from?

PSMDTAG:FAQ: How can a script determine what directory it was invoked from? PSMDTAG:FAQ: What is $MyInvocation? PSMDTAG:FAQ: Why is $MyInvocation.ScriptName empty? Create 2 scripts (First.PS1 and Second.PS1) to explore what is going on with $MyInvocation
Posted by PowerShellTeam | 2 Comments
Filed under: ,

Use of Preference Variables to control behavior of streams

PSMDTAG:FAQ: Why don't I see output when I use Write-Verbose and Write-Debug? PSMDTAG:SHELL: Use of Preference Variables to control behavior of streams. In Windows PowerShell, the WRITE-XXX cmdlets merely sends things to a Named stream. You then have
Posted by PowerShellTeam | 0 Comments
Filed under: ,

Perserving Command History Across Sessions

<Edited 7/2/2006 to add tags and Categories> Ben Winzenz didn't like the fact that Windows PowerShell did not maintain history lists between sessions ( http://winzenz.blogspot.com/2006/06/cool-mshpowershell-tidbit.html ) . We hear you Ben. Back
Posted by PowerShellTeam | 17 Comments
Filed under: , ,
 
Page view tracker