Showing archive results for 2006

Apr 25, 2006
Post comments count0
Post likes count0

Mshsnapin (part 2): developing a mshsnapin.

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

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

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

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

 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

Why did you do that? $VAR/ {} / Weak Intellisense

PowerShell Team

I strongly encourage people to let us know where we could be doing better and to let us know if we are getting into the weeds.  I believe that being open to such bad news is core to the the virtuous cycle of self improvement so such feedback provides opportunities to reflect and make changes when appropriate.  Other times&...

FAQPHILOSOPHY
Apr 25, 2006
Post comments count0
Post likes count0

Monitor the Event Log

PowerShell Team

Administrators often want to monitor the event logs and look for specific error conditions.  The most capable way to do this, of course, is to use a dedicated monitoring application such as Microsoft Operations Manager, or get down-and-dirty with the Win32 API NotifyChangeEventLog.  However, Monad can be used for simple applications. Supp...

CMDLET
Apr 25, 2006
Post comments count0
Post likes count0

GetObject()

PowerShell Team

Monad provides a way to create new com objects with new-object $ie = New-Object -ComObject InternetExplorer.Application$ie.Navigate2(http://blogs.msdn.com/monad)$ie.Visible=1 Great but what about if you want to bind to an existing object?  Where is the equivalent of GetObject()? This is one of those good new/bad news stories.  First the b...

FAQCOM
Apr 25, 2006
Post comments count0
Post likes count0

Base64 Encode/Decode a string

PowerShell Team

Today I came across http://scripts.readify.net/  . This sight is focused on Monad and MSH and is starting a collection of scripts at: http://scripts.readify.net/Scripts.aspx .  You should visit their site and let them know what type of scripts would be useful to you.  I particularly liked their entry on how to Base64 encode a f...

FAQPHILOSOPHYDOTNET
Apr 25, 2006
Post comments count0
Post likes count0

Check Spelling Script

PowerShell Team

After reading Marcel's introductory piece on ScriptBlock, I decided to rewrite an old script of mine that checks the spelling of all text files in a directory. Here is what I came out with. #region Parse a line to a list of words $StringFind ={param ($str, $start, $cond)  if ($start -ge 0 -and $start -lt $str.Length...