News

 Subscribe Add to Technorati Favorites

 

 

 

 


 

 

Search My Blog:

 

 

My Stats

  • Posts - 468
  • Comments - 242
  • Trackbacks - 265

Twitter












Tag Cloud


Recent Comments


Recent Posts


Archives


Post Categories


Blogs


Miscellanous


Noteworthy Stuff


Popular Posts


November 2006 Entries

Vivek's out-ie and out-html scripts, Netcmdlets convert-data cmdlet


I found Vivek Sharma's blog through Jeffrey Snover on the MS PowerShell blog. He's got some good geeky stuff there, including some useful PowerShell posts.

Vivek's out-ie is useful, so I snagged that for myself. I tried to create an out-ff but I hit a stumbling block because the Mozilla ActiveX Control requires a control container. out-html is not so useful because convertto-html already comes with powershell.

NetCmdlets now includes a convert-data cmdlet which converts data to and from many different encodings: uuencode, base64, quoted-printable, url-encoding, JIS, Yenc, and hex. It can also create md5 and sha1 hashes.

Technorati : , , ,

posted @ Wednesday, November 29, 2006 2:59 PM | Feedback (1) |


How to change your active directory password


Last year I posted the rules about how to remotely change your LDAP password. Its not very obvious because of the fact that the procedure depends on what server you're using (Active Directory, OpenLDAP, Novell, etc), and even then how your server is configured.

Here is how you would change your password using the LDAPS component of IP*Works!! SSL (note, an SSL connection is required in order to change your password remotely if you are an Active Directory user. Otherwise you can do this with the LDAP component in the regular IPWorks toolkit).

If you're not using IPWorks, the same rules apply, so adjust your code accordingly.  Here's a way to do it in PowerShell.

 

public void ChangePassword(string dn, string newpassword)
{
//Changing passwords depends on what directory server you're using:
//for Active Directory:

//*** You must have SSL connection in order for this to be allowed by AD!
//Also, this particular method of changing the password requires that you are already bound as Admin.
//Otherwise, you need to first delete the password providing the current value, and then

//re-add the password again with the new value.

ldap1.DN = dn;
ldap1.AttrCount = 1;
ldap1.AttrType[0] = "unicodePwd";
ldap1.AttrValueB[0] = System.Text.Encoding.Unicode.GetBytes("\"" + newpassword + "\"");
ldap1.AttrModOp[0] = LdapsAttrModOps.amoReplace;
ldap1.Modify();
if (ldap1.ResultCode != 0) { /* report/handle error here */ }

//for non-AD (ie Novell, OpenLdap, SunOne (iPlanet), etc): //No SSL is required /*
ldap1.DN = dn;
ldap1.AttrCount = 1;
ldap1.AttrType[0] = "userPassword";
ldap1.AttrValue[0] = newpassword;
ldap1.AttrModOp[0] = LdapsAttrModOps.amoReplace;
ldap1.Modify();
if (ldap1.ResultCode != 0) { /* report/handle error here */
}
*/
}

Technorati : , , , , , ,

posted @ Tuesday, November 28, 2006 3:19 PM | Feedback (0) |


PowerShell 1.0 Released


PowerShell 1.0 was released yesterday in Spain, and /n software was there! When you go to download it (for free), don't forget to pickup NetCmdlets too.

Also check out Jeffrey Snover's 12 Cool Features of Windows PowerShell.

You'll need to uninstall previous versions of PowerShell before you can install the new one, but PowerShell won't appear in Add/Remove Programs unless you check the "show updates" box.

Technorati : , ,

posted @ Wednesday, November 15, 2006 10:34 AM | Feedback (2) |


ATTENTION


ALIENS ARE COMING TO ABDUCT ALL THE GOOD LOOKING AND SEXY PEOPLE. YOU WILL BE SAFE, I'M JUST POSTING TO SAY GOODBYE.

posted @ Tuesday, November 14, 2006 10:34 PM | Feedback (3) |


Output any newsgroup as an RSS feed in a half dozen lines of code


Update:  I changed the feed to default to partial length, only the first 1000 characters of the article body.  To change it to get the full body, add another querystring parameter named full with value true, ie: http://www.textbox1.com/examples/newsgroupfeed.rsb?currentgroup=microsoft.public.dotnet.general&range=10&full=true.

Output any newsgroup as an RSS feed in a half dozen lines of code. Thats pretty impressive, really. How? With RSSBus and a little script that calls RSSBus NntpOps.

Here's an RSS feed of the latest 25 articles in the microsoft.public.dotnet.languages.csharp newsgroup: http://www.textbox1.com/examples/newsgroupfeed.rsb

You can get a different group or a different number of messages by overriding the server, currentgroup, and range in the querystring. For example, here's a feed of the last 10 articles in the microsoft.public.dotnet.general newsgroup:
http://www.textbox1.com/examples/newsgroupfeed.rsb?currentgroup=microsoft.public.dotnet.general&range=10.

Here's how I did it.

First, the starter script code (notice its only 6 lines of code not counting the comments):

<rsb:call op="nntpListArticles">
  <rsb:call op="nntpGetArticle?currentarticle=[messageid]">
    <!-- format the description -->
    <rsb:set attr="rss:description" 
value="From [nntp:from] <br /> [nntp:date] <p /> [nntp:bodytext | Replace('0D','<br>','ishex')]" /> <!-- push this article out as an RSS item --> <rsb:push /> </rsb:call> </rsb:call>

To get a feed of the latest 25 articles in the microsoft.public.dotnet.languages.csharp newsgroup, just call this script like so:

http://rssbus-server/newsgroupfeed.rsb?server=msnews.microsoft.com&currentgroup=microsoft.public.dotnet.languages.csharp&range=25

You can eliminate the need for querystring arguments by defining defaults inside the script itself. We use an rsb:info xml element for this:


<rsb:info treatas="feed" strict="true" description="Articles of a newsgroup">
  <input name="currentgroup" default="microsoft.public.dotnet.languages.csharp"/> 
  <input name="range" default="5"/> 
  <input name="server" default="msnews.microsoft.com"/> 
</rsb:info>
  
<rsb:call op="nntpListArticles">
  <rsb:call op="nntpGetArticle?currentarticle=[messageid]">
    <!-- format the description -->
    <rsb:set attr="rss:description" value="From [nntp:from]<br />[nntp:date]<p />[nntp:bodytext | Replace('0D','<br>','ishex')]" />
    <!-- provide a link to this message in google groups, also add a guid -->
    <rsb:set attr="rss:link">
    http://groups.google.com/groups?threadm=[nntp:id | Replace('<', '') | Replace('>', '') | urlencode]
    </rsb:set>
    <rsb:set attr="rss:guid" value="[rss:link]" />

<!-- clear unused data for bandwidth preservation -->
<rsb:unset attr="nntp:bodytext" />
<rsb:unset attr="nntp:headers" />
<rsb:unset attr="nntp:subject" />
  
<!-- push this article out as an RSS item -->
<rsb:push />
</rsb:call>
</rsb:call>

Also notice the 'treatas="feed"' inside the rsb:info statement. I could instantly turn this into a MS Simple List Extension feed by changing this to 'treatas="list"'.

Technorati : ,

posted @ Friday, November 10, 2006 5:08 PM | Feedback (0) |


PowerShell verb list


Here is a list of PowerShell cmdlet verbs on MSDN.

Technorati : ,

posted @ Friday, November 10, 2006 2:34 PM | Feedback (0) |


followthemoney.com


Featured on Programmable Web a couple weeks ago was an API from the Institude On Money in State Politics that allows you to track campaign contributions for candidates. It is pretty neat, and should come in quite handily in 2008. Here is their a view of their data for North Carolina.

A while back I posted about Project Vote Smart, and the news that they are planning to make an API available "well before the 2008 elections". With the massive amount of information available at Project Vote Smart, this means interesting things for future web applications and social networking. I'm already excited about the vote in 2008.

Technorati : , ,

posted @ Thursday, November 09, 2006 4:23 PM | Feedback (0) |


NetCmdlets Part 2: PowerShell cmdlet for SNMP (network management)


The SNMP PowerShell cmdlets that come with /n software NetCmdlets support SNMP v1, v2c, and v3, SNMPv3 auth/priv, MIB loading, etc. Here are some examples of using the Get-SNMP, Set-SNMP, Send-Trap, and Get-Trap cmdlets.

Find SNMP enabled machines (agents) on your network:
PS C:\> get-snmp -agent 255.255.255.255 -oid sysName.0

Find processes running on a remote snmp-enabled machine:
PS C:\> get-snmp -agent myagent -oid hrSWRunName -walk $true

Send an SNMP trap to a remote manager:
PS C:\> send-trap -manager somemgr -oid coldStart

Set the system contact information for an agent:
PS C:\> set-snmp -agent myagent -oid sysContact.0 -value lance@nsoftware.com

There's a cool demo that comes installed with NetCmdlets that shows how to find the network throughput utilization of each network interface on a particular agent. It does this by walking the ifTable (interface table), checking the bytes going in and out over time and comparing that to the speed of the interface:

Technorati : , , ,

posted @ Thursday, November 09, 2006 12:10 PM | Feedback (1) |


NetCmdlets Part 1: PowerShell cmdlet for FTP (plus FTPS and SFTP)


Some examples of using NetCmdlets in PowerShell. The FTP NetCmdlet supports plain and secure (both SSL and SSH) FTP connections right from the PowerShell console.

List files on a remote server:

PS C:\> get-ftp -server myserver -user lancer -password mypass

The same, but using SSL (auth-tls):

PS C:\> get-ftp -server myserver -user lancer -password mypass -ssl explicit

And again, but using SSH 2.0:

PS C:\> get-ftp -server myserver -user lancer -password mypass -ssh

Find the files on a remote server that are larger than 10 Megs:

PS C:\> get-ftp -server myserver -user lancer -password mypass| where { $_.FileSize -gt 10MB }

Delete a file on a remote FTP server:

send-ftp -server myserver -user lancer -password mypass -delete filetodelete.txt

Delete all files on a remote FTP server that are greater than 10 Megs:
PS C:\>get-ftp -server myserver -user lancer -password mypass| foreach-object -process {send-ftp -server myserver -user lancer -password mypass -delete $_.FileName}

Calculate the number of bytes in the files of a remote server directory:

PS C:\> get-ftp -server myserver -user lancer -password mypass -path / | measure-object -property FileSize -sum

Find all the local .txt files and upload them to a remote FTP server:

PS C:\> get-childitem *.txt | select Name | set-ftp -server myserver -user lancer -password mypassword -localfile $_ -remotefile $_

Technorati : , , , , ,

posted @ Thursday, November 09, 2006 11:37 AM | Feedback (6) |


CNN Breaking News: I don't care about Britney's marital status


-- CNN believes that the marital status of formerly attractive pop-princess Britney Spears is vital to my day.

Watch CNN or log on to http://CNN.com and watch FREE video, plus live, commercial-free video with CNN Pipeline. CNN - The most trusted name in news.

Seriously though...this is the "CNN Breaking News" that I just got in my inbox. I got a similar email when Mel Gibson got busted for his DUI. Why either of these is ever displayed prominently on CNN.com or is ever considered "breaking news" is beyond me. This is not "Entertainment Tonight Alerts" or CNN's own "Showbiz Tonight" newsletter, people...its "CNN Alerts". Good grief.

-- Britney Spears files for divorce from her husband Kevin Federline, citing irreconcilable differences.

Watch CNN or log on to http://CNN.com and watch FREE video, plus live, commercial-free video with CNN Pipeline. CNN - The most trusted name in news.


posted @ Tuesday, November 07, 2006 4:15 PM | Feedback (4) |


AmzWish updated for Amazon.ca, .co.uk, .fr, .de.


I added support for users outside the US to use the Amazon Wishlist widget. Now all my Canadian friends can use it too (not to mention UK, Fr, etc). :)

Current parameter list:

  1. wishlistid - An Amazon assigned Id for a particular wishlist to use (required).
  2. maxitems - The number of items to display in the widget (optional, defaults to 4).
  3. associatesid - An Amazon Associates Id to use, so that you can get paid when people buy things from the widget (optional).
  4. sorttype - For now there are only two accepted values: "random" and "none". None outputs the items in the order of the date they were added to your wishlist (most recent first). Random outputs the items in random order (optional, defaults to none).
  5. locale - New support for international users. The following locale strings are now supported: us, uk, ca, fr, and de.

Technorati : , , , ,

posted @ Tuesday, November 07, 2006 4:05 PM | Feedback (0) |


Powershell scripting contest


Windows PowerShell Scripting Sweepstakes.

I think its kinda funny, though, that the first prize teaser in the description of the contest is two "all-expenses paid trips to Redmond, WA to meet the Windows PowerShell team". You know I'm sure I would enjoy meeting you all and everything...but I'd rather just have the Xbox. Unless I can get the xbox AND the trip to Redmond. :)

Submit your entry scripts in one (or all) of 12 categories:

  1. Active Directory
  2. SQL Databases
  3. IIS 6.0/7.0
  4. Networking
  5. Partner Category: PowerGadgets and NSoftware Network Management Cmdlets (free downloads)
  6. Hardware Asset/Hardware Configuration
  7. Inventory: Hardware, Operating System Settings, Installed Applications and Updates
  8. Registry/Windows Management Instrumentation (WMI)
  9. File System (quotas, permissions, etc.) or File Tasks (text files, XML, HTML, etc.)
  10. Exchange Server 2007
  11. System Center Operations Manager 2007
  12. Other Category (any useful script for customizing Windows PowerShell or managing systems via Windows PowerShell; Heck if you want to submit a GUI layered over cmdlets, we will consider that as a valid submission)

You might notice that category #5 mentions PowerGadgets (cmdlets for charting and graphing data) and /n software's NetCmdlets (cmdlets for secure network communication and management). I've been playing with both of these a lot recently, so look for more posts coming from me in the near future about both of these and PowerShell in general.

Technorati : , ,

posted @ Monday, November 06, 2006 1:41 PM | Feedback (0) |


RSSBus SLE feed example: stock quotes


The RSSBus Bus

As it turns out, a lot of the operations provided by RSSBus work great as lists using Microsoft's Simple List Extensions (see previous post if you aren't familiar with SLE). As an example, consider the yahooStockQuotes operation. If you only wanted to be able to track the latest quote of your favorite stock(s), a list would work perfectly. No need to store historical items about previous quotes in your feed reader. If your reader is smart enough to analyze historical data and give you charts and graphs, that will be a different story, and you can easily change the feed to a regular one instead of a list by just turning on a simple treatas feed attribute).

As an example of an RSSBus generated SLE feed, I put up a sample stock quote script (view source). This script takes one querystring parameter called "symbols", for which the value is a space separated list of symbols to query for. You can subscribe to this feed in your own feed reader, replace the symbols querystring value with your favorite stocks, and voila.


Technorati : , , ,

posted @ Thursday, November 02, 2006 2:40 PM | Feedback (3) |


RSSBus and Simple List Extensions


One of the changes in beta 3 of RSSBus is that by default all feeds produced use Microsoft's Simple List Extensions.

For anyone who's not familiar with SLE, the cool thing about it is that it can tell the feed reader to treat an RSS feed as a LIST rather than a regular feed. One effect of this in your feed reader is that when you subscribe to a LIST, the reader knows that it shouldn't accumulate all of the items in the RSS feed forever. Instead, it will only maintain whatever is provided in the current feed as a standalone list, no saving of old items necessary.

The RSS Team blog entry about SLE points out a few of real world examples where this is the desirable behavior. View these in IE7 to see the features of SLE come to life.

When someone buys something from your Amazon.com Wish List (perhaps through the AmzWish widget) and that item is subsequently removed from your wish list, there's no reason for it to still be displayed by your feed reader as a part of your wish list feed. Similarly, when Hinder's "Lips of An Angel" is no longer Yahoo's #1 song, your feed reader shouldn't maintain that old #1 ranking, it should show in the list that Hinder has fallen out of the top 10 (one can only hope) and delete that item from its local copy of the list. When you view the list in your feed reader it will still show all 10 items, even if some of them have not changed and have already been "read".

Another great feature of SLE is that it also identifies to the feed reader which elements of items the reader should allow the user to sort the list by. The Amazon Wish List feed suggests to the reader that you can sort the list by price, sales rank, number of reviews, etc. Also SLE lets the reader put items into groups. The Amazon Wish List feed tells the reader that it can sort the feed by product category, ie Books, DVDs, Music, etc. Neat, huh?

For more on the difference between a regular feed and a list, read the "Identifying a List" section of this RSS Team blog entry.

Technorati : , , ,

posted @ Thursday, November 02, 2006 2:22 PM | Feedback (0) |


RSSBus Beta 3 Available


The new beta 3 of RSSBus was announced last week:

"We have spent the past couple of months hardening the RSSBus Engine and preparing it for production. You will notice significant performance improvements, better error handling, better integration with ASP.NET, and a better security infrastructure." Read the full announcement.


Technorati : , ,

posted @ Thursday, November 02, 2006 12:09 PM | Feedback (0) |


Amazon wishlist widget


AmzWish was posted on programmableweb last week as one of the best new mashups.

Technorati : , , , ,

posted @ Wednesday, November 01, 2006 10:43 AM | Feedback (0) |


Windows Power Shell Quick Start


Here's the Windows Power Shell Quick Start at Channel 9. This is a nice little quick resource for anyone interested in playing with the PowerShell scripting language.

posted @ Wednesday, November 01, 2006 9:18 AM | Feedback (0) |


Need an RSS feed? Don't want to have to write code?


Bob Walsh over at My Micro-ISV invited me to make a guest post about RSSBus and how you can use it to generate RSS feeds without having to write any code. Check it out!

Technorati : , ,

posted @ Wednesday, November 01, 2006 9:17 AM | Feedback (0) |


Beck - "Clap Hands" performance on the most recent episode of SNL


Beck - "Clap Hands" performance on the most recent episode of SNL. Simply an amazing performance, maybe the most enjoyable performance I've ever seen on Saturday Night Live (except maybe the one where Ashley Simpson got busted lip synching which was just hilarious).

In this show, the band is playing a set dinner table instead of their regular instruments.


Technorati : , ,

posted @ Wednesday, November 01, 2006 9:17 AM | Feedback (1) |