Friday, November 15, 2013

PowerShell and TCP/IP Protocols

Lee Holmes, of Windows PowerShell Cookbook fame and a member of the PowerShell development team, has just published an interesting article on Interacting with Internet Protocols.  In the article, he shows how you can do some cool stuff, in particular interacting with a remote POP3 mailbox.

This is a great introduction to using PowerShell to leverage the lower level networking functionality built into the .NET Framework. The .NET Framework provides classes that enable you to leverage many of the Internet protocols directly. He cites the System.Web.Mail.SmtpMail class for SMTP,  and the System.Net.WebClient class for HTTP.  He also notes that where the .NET Framework does not support an Internet protocol directly, you can often script the application protocol directly if you know the details of how it works. His example of this is a sample that retrieves information waiting in a remote POP3 mailbox.

Using the .NET framework to, in effect, implement higher level protocols which do not exist in the Framework is a pretty cool thing to do. But I think you quickly realise that unless you REALLY need to, doing a good job at developing scripts that use POP3, for example, involves quite a lot of work.

If you do plan to do a lot of network level programming, you might also want to take a look at /N software and their NetCmdlets package. This package is NOT, however, free. There is a free personal edition, giving a single server license and a single concurrent connection. The unlimited connection package, again for just a single server license, is US$899. They also have a site license to handle multiple servers.

No comments: