Friday, September 30, 2005

 
Modifying Registry Using MSH

MSH has a registry provider built-in. You can manipulate the registry just like you do with the file system. Here is an example session on modifying registry.

# Change to the HKLM\SOFTWARE key, note the ':'
# between HKLM and \SOFTWARE.
cd HKLM:\SOFTWARE

# Create a key HKLM\SOFTWARE\mshtest.
new-item mshtest

# Set a value for the key.
set-item mshtest -value TestValue

# Change the key value to DWORD type.
set-item mshtest -value 10 -type dword

# Create a new value mshvalue under the key.
set-property mshtest -property mshvalue -value value1

# Change the value to DWORD type.
set-property mshtest -property mshvalue -value 10 -type dword

# Delete the 'mshvalue' value.
remove-property mshtest -property mshvalue

# Delete the mshtest key.
remove-item mshtest


Note that in this example, I used the relative path. If you prefer the full path use HKLM:\SOFTWARE\mshtest instead of just mshtest.

Wednesday, September 28, 2005

 
TextPad Syntax Definitions File for MSH

I created this syntax file based upon the "Getting Started Guide to Using the MSH Shell and Language" in WinFX SDK. Let me know if you find anything that would improves the file.

Thursday, September 22, 2005

 
Sending email using MSH

This example is modified from one of my old VBScripts. It uses CDO to send message.


function email
($from, $to, $subject, $textbody)
{
$msg = new-object -com CDO.Message
$msg.From = $from
$msg.To = $to
$msg.Subject = $subject
$msg.Textbody = $textbody
$msg.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
$msg.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.nospam.com"
$msg.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
$msg.Configuration.Fields.Update()
$msg.Send()
}

email "someone@nospam.com" "someone@nospam.com" "test using msh" "hello, world!"

 
Microsoft "Monad" Shell Beta 2 Download Available

http://www.microsoft.com/downloads/details.aspx?FamilyID=2ac59b30-5a44-4782-b0b7-79fe2efd1280&displaylang=en

You also need .Net Framework Version 2 Beta 2.

http://www.microsoft.com/downloads/details.aspx?familyid=7ABD8C8F-287E-4C7E-9A4A-A4ECFF40FC8E&displaylang=en

This page is powered by Blogger. Isn't yours?