Showing archive results for April 2006

Apr 25, 2006
Post comments count0
Post likes count0

Ensuring Script Portability with #requires

PowerShell Team
PowerShell Team

With the MshSnapIn model in Beta 3, there is no gaurantee that a certain Cmdlet or Provider, apart from those in the default MshSnapIns, is available at any point. There could be a number of reasons. The MshSnapIn may not have been installed. The MshSnapIn could be removed with the remove-mshsnapin Cmdlet or&nb...

Apr 25, 2006
Post comments count0
Post likes count0

Single Shell vs Custom Shell

PowerShell Team
PowerShell Team

With Monad Beta 3 release, we've introduced the concept of the "single shell". What is a single shell? "One shell to rule them all ... and in the darkness..." (Sorry I can't stop saying that quote everytime I hear "single shell"!) Well rather than having to create a separate executable/shell to host your own cmdlets/providers, you can now create...

Apr 25, 2006
Post comments count0
Post likes count0

Mshsnapin (part 2): developing a mshsnapin.

PowerShell Team
PowerShell Team

To develop a mshsnapin, you can use following three simple steps, Following is the sample code for a mshsnapin class. Basically, you just need to fill in information about name, vendor and description of the mshsnapin. namespace XYZ.TestNameSpace{    [RunInstaller(true)]    public class MyMshSnapIn : M...

Apr 25, 2006
Post comments count0
Post likes count0

Mshsnapin (part 1): usage of mshsnapin commands.

PowerShell Team
PowerShell Team

Latest beta3 release of monad added the capability of adding/removing cmdlets and providers in current running session through mshsnapins. Mshsnapin is a logic group of cmdlets and providers can be manipulate as a unit in monad engine. Following commands can be used for manipulating mshsnapins, - George [Edit: Monad has now ...

Apr 25, 2006
Post comments count0
Post likes count0

Using Monad for logon scripts

PowerShell Team
PowerShell Team

In case you were wondering, yes, you can use Monad for your logon scripts.  You can't just assign a .MSH file as a logon script however, since only file types with file associations work as logon scripts.  Monad installation doesn't create a file association ".MSH -> msh.exe -command %1" for security reasons.  The best way to r...

Apr 25, 2006
Post comments count0
Post likes count1

Managing non-terminating errors

PowerShell Team
PowerShell Team

Most errors which occur in your working scripts are likely to be "non-terminating".  This means that Monad just reports the error and the command keeps running.  ("Terminating" errors such as syntax errors will halt the command and, in some cases, the entire script; see http://blogs.msdn.com/monad/archive/2005/11/15/493102.aspx for mor...

Apr 25, 2006
Post comments count0
Post likes count0

Getting MSDN help urls for .NET BCL types and Members

PowerShell Team
PowerShell Team

 Often when playing with .Net objects in Monad, I need to use MSDN class library reference to learn how to use a particular type and its members. Now, I have my bookmarks and favorite search engine but I always thought it would be cool if get-member cmdlet could provide me a help link/reference to go to. Thanks to the way MSDN org...

Apr 25, 2006
Post comments count0
Post likes count0

Finding out what determines which properties are displayed

PowerShell Team
PowerShell Team

MoW, a Monad newsgroup regular, asked why only the Caption, Name and PeakUsage properties were displayed from the command “get-WMIObject Win32_PageFileUsage” while the output object had a lot more properties. I think it is worth it to explain in details how to find out which properties are displayed.First, I would look at which view defined in one ...

FAQINTERNALCMDLET
Apr 25, 2006
Post comments count0
Post likes count0

Sunday morning drive with my hair on fire: Types/Community/Synthetic types/Democracy/Cool XML tricks

PowerShell Team
PowerShell Team

Exploring types is a pain! Monad provides Get-Member which makes it pretty nice to explore an OBJECT but if you want to explore that object's type, you have to use the capabilities of the System.RuntimeType class. Let me make that distinction a little clearer.  Imagine that I've got some xml:$x=[XML]"<a><b>TEST</b><a>" ...

FAQDOTNETCMDLET
Apr 25, 2006
Post comments count0
Post likes count0

Comparative Examples in MSH and KSH

PowerShell Team
PowerShell Team

  Most shells (such as Windows CMD.EXE and the UNIX shells SH, KSH, CSH, and BASH) operate by executing a command or utility in a new process, and presenting the results (or errors) to the user as text. Text-based processing is the way in which system interaction is done with these shells. Over the years, a large number of text processing uti...

FAQDOTNETSHELL