Thursday, December 27, 2007

Windows PowerShell Virtual User Group #2 meeting video--ONLINE!

As in my first meeting, the process to edit the WMV created by Live Meeting 2007 requires a few steps.

Finally, my videos from my 2nd meeting detailed HERE are online.

Here's the resulting files, which I've split up by presenter (each is roughly 15-25MB).

  • Marco Shaw's introduction

I introduce myself, the user group.  I talk about the agenda, thank Microsoft and PowerGadgets for sponsoring this meeting, do some quick polls, then introduce each speaker. 

Don started off after my introduction and talked about the new PowerShell Community site, Sapien's 2nd edition of PowerShell: TFM, and Sapien's PowerShell training.

Dmitry was going to talk about Quest's Active Directory cmdlets and PowerGUI.  Dmitry had technical problems and was not able to complete his talk.  I'm hoping he will want to redo his presentation at a later time.

Oisin did a presentation on advanced development he's working on with the PowerShell Community Extensions and talked about his other project on Codeplex called PSEventing.  The first 2 links are for PSCX development, and the 3rd is for PSEventing only.

 

Jeffrey from the Microsoft PowerShell development team talked about the new PowerShell 2.0 Community Technology Preview (CTP).

 

I'll announce the tentative details for meeting #3 next week.  It is tentatively planned for January 16, 2008 at 8PM EST (New York time).

Saturday, December 22, 2007

Guest blog post on PowerGadgets.com

I posted a guest blog entry HERE yesterday on the PowerGadgets blog section.

"Something that has come up quite a bit is people asking how they can possibly hide sensitive information in their PowerGadgets files.  When you use the PowerGadgets Creator, your gadget is saved in a .pgf file extension which is basically XML formatted data..."

Basically, I pull together two of my other posts HERE and HERE to demonstrate how people using PowerGadgets can somewhat hide sensitive data from what are usually plain XML formatted text files.  This is definitely useful when one wants to distribute files to other PowerGadgets users, but wants to keep the details of the PowerShell commands run a secret.

Thursday, December 13, 2007

TechMentor San Fransicso speaker

I will be doing 2 talks at TechMentor in San Francisco on Monday, March 31, 2008:

#1: Building a GUI in Windows PowerShell

In this session, MVP Marco Shaw will guide you through using Windows Forms from the .NET Framework to build lightweight, fully functional graphical user interfaces (GUIs) that run within Windows PowerShell scripts.  You will be guided through the Windows Forms hierarchy and be shown practical and effective examples for creating, fine-tuning and using your using your own customized GUIs directly from within Windows PowerShell. This is an intermediate session: You should have a basic understanding of PowerShell scripting in order to take full advantage of this session.

#2: Managing Remote Systems the Windows PowerShell V2 Way

In this session, MVP Marco Shaw will discuss the new remoting features that will be available in the next version of Windows PowerShell currently being offered as a Community Technology Preview (CTP). This session will focus on the usage of: the new functionality that comes with the Invoke-Expression cmdlet and the usage of the new *-PSJob and *-Runspace cmdlets. The concepts of "fan-in", "fan-out" and interactive remoting will also be discussed. This is an intermediate session: You should have a basic understanding of PowerShell scripting in order to take full advantage of this session.

(Above is directory quoted from the TechMentor site.)

Drop me a comment if you'll be there or are from the San Fransicso area.

Fellow MVP Brandon Shell and also Microsoft's Bruce Payette will be doing sessions also.

Windows PowerShell™ v1.0: TFM® 2nd Edition

I reported back in June HERE that I was reviewing a book for Sapien.  Well, the NDA is over and the book an my involvement is announced HERE.  The book is the 2nd edition of Sapien Press' PowerShell: TFM book.

I reviewed about 150 pages of the book on the more advanced concepts, and I think the content overall is great.  This 2nd edition have many improvements over the 1st edition.

Don and Jeffery also already have a early release version of a 3rd edition covering the PowerShell 2.0 CTP!

Tuesday, December 11, 2007

Windows PowerShell Virtual User Group Meeting #2--update

Last week, I held my second virtual user group meeting announced HERE.  Overall, things went relatively well. 

Don Jones (MVP) started off after my introduction and talked about the new PowerShell Community site, Sapien's 2nd edition of PowerShell: TFM, and Sapien's PowerShell training.

Next was Dmitry Sotnikov (MVP) who was going to talk about Quest's Active Directory cmdlets and PowerGUI.  Dmitry had technical problems and was not able to complete his talk.  I'm hoping he will want to redo his presentation at a later time.

After Dmitry, Oisin Grehan did a presentation on advanced development he's working on with the PowerShell Community Extensions and talked about his other project on Codeplex called PSEventing.

Last up was Jeffrey Snover from the Microsoft PowerShell development team.  Jeffrey talked about the new PowerShell 2.0 Community Technology Preview (CTP).

Near the end, I made the mistake again of leaving myself on mute.  I talked away for at least 5 minutes while on mute to finish the meeting.  Maybe I'll get this right by meeting #3.

I've got the entire session recorded as a raw 10MB file.  I'll need to edit it and re-encode it, etc. before it is somewhat presentable.

I'll post an update when it is ready for viewing.

I've started planning meeting #3 for the mid-January timeframe.  Details to be announced in the next week or so with the list of tentative speakers.

Sunday, November 11, 2007

An example of using scriptcmdlets (from the PowerShell v2 CTP)

I just posted a new blog entry on the PowerShell Community site.  My blog entry is here.  I explain how to use PowerLocker  to encrypt scripts that use the new scriptcmdlets features of the v2 CTP.  The resulting output is a true .NET object.

(There are other ways to encrypt PowerShell scripts, yet a few of these methods can only output simple strings, which may not always be handy.)

Thursday, November 8, 2007

Windows PowerShell Virtual User Group Meeting #2

Windows PowerShell Virtual User Group Meeting  #2

Time: December 4th, 2007 at 12PM (noon) EST (New York time)
Place: Online via Live Meeting 2007

-----------------------------------------------------------
To sign up:
-----------------------------------------------------------

Registration site: http://www.clicktoattend.com/?id=122431
Event Code: 122431

-----------------------------------------------------------

This is our second virtual event.  Invited speakers that will talk about various PowerShell-related topics: Don Jones (MVP), Dmitry Sotnikov (MVP), Oisin Grehan and Jeffrey Snover (Microsoft).

To join:
https://www112.livemeeting.com/cc/microsoft/join?id=5K9Z2F&role=attend&pw=wW!jC8R5b

Unable to join the meeting?  Follow these steps:
1.Copy this address and paste into your web browser:
https://www123.livemeeting.com/cc/microsoft/join
2.Copy and paste the required information:
Meeting ID: 5K9Z2F
Entry Code: wW!jC8R5b
(NOTE: Our first meeting allowed people to call-in to listen the the audio.  This was very distracting, so this second meeting will only offer audio streaming over the Internet.  Therefore, you will need access to speakers or a headset to listen to the audio.  This session will be recorded and available for offline viewing later.)

Agenda:
12:00PM-12:10PM: Introduction
12:10PM-12:25PM: Don Jones (MVP)
12:25PM-12:40PM: Dmitry Sotnikov (MVP)
12:40PM-12:55PM: Oisin Grehan
12:55PM-1:15PM: Jeffrey Snover (Microsoft)
1:15PM-1:20PM: Closing
1:20PM-1:30PM: Live Q & A

Speaker topics (more details *soon* on http://www.powershellcommunity.org):
*Don Jones (MVP): New community site, new PowerShell TFM book and training.
*Dmitry Sotnikov (MVP):  Active Directory cmdlets and PowerGUI.
*Oisin Grehan: PowerShell Community Extensions development and .NET, COM and WMI Event handling in PowerShell
*Jeffrey Snover (Microsoft):  To be determined.

Notes:
All details related to this event will be posted on http://www.powershellcommunity.org.

Sponsors/partners:
Microsoft TechNet, PowerGadgets, Sapien, Quest and Nivot Inc.

Tuesday, November 6, 2007

PowerShell 2.0 CTP

*************************************************

The PowerShell V2 CTP is not for everyone. You should read this PowerShell Team blog entry ( http://blogs.msdn.com/powershell/archive/2007/11/02/ctp-watch-this-space.aspx ) to find out what it is and what it isn't and then make an informed decision before installing the CTP.

*************************************************

Windows PowerShell 2.0 CTP is out.  View the PowerShell team blog entry here.

As a Microsoft MVP, I had the chance to try out earlier CTP bits, and I like what I saw, in particular:

  • PowerShell Remoting
  • Background Jobs

For those also wanting to write scripts, yet use something other than Notepad, you may be pleased that there is a script editor bundled now.  It is still a very early release though.  For other free options, check out PowerGUI, which has a script editor as well.

Wednesday, October 24, 2007

TechNet Webcast: Automating Internet Information Services 7.0 (Level 300)--UPDATE

The event I posted here has been changed from October 25th, to November 28th.

The new details are:

Start Time:
Date: 11/28/2007
Time: 01:00 PM-02:30 PM
U.S. Pacific Standard Time (GMT -8 hours)

Tuesday, October 23, 2007

TechNet Webcast: Automating Internet Information Services 7.0 (Level 300)

Start Time:
Thursday, October 25, 2007 9:30 AM Pacific Time (US & Canada)
Event Overview

Tired of spending long nights doing the same tasks over and over? Join this webcast to learn how you can save time and get your life back though automation. We take a look at all the new ways you can automate tasks within Microsoft Internet Information Services (IIS) version 7.0 by using Windows Powershell, our revamped Windows Management Instrumentation (WMI) provider, the appcmd.exe command-line tool, and the new managed code administration API, all from the command line! We demonstrate how to use the command line by automating common tasks to complex configurations. Attend this session to see how to complete unattended installations of IIS 7.0, set up thousands of sites in a matter of minutes, and manage installations of IIS on Server Core. This is a must-see webcast for any administrator!

Sign Up:

https://msevents.microsoft.com/cui/r.aspx?r=1292762890&c=en-US&t=4

Language(s):
English.

Product(s):
Windows Server.

Audience(s):
IT Professionals.

Duration:
90 Minutes

Presenter: Ruslan Yakushev, Senior Program Manager, Microsoft Corporation

Monday, October 22, 2007

PowerShell SDK book - February 2008

Wrox just recently put up a link to "Professional Windows PowerShell Programming: Snapins, Cmdlets, Hosts and Providers" (current link here).

This book was previously on Amazon for several months, and the due date has changed a few times and is now February.

This is another book I'm really looking forward to.  I've written a few cmdlets, and would now like to get into writing providers just to go through the exercise.

Sunday, October 21, 2007

I am writing for TechNet Magazine

I've submitted an article to Microsoft's TechNet Magazine, and they have agreed to publish it! 

It will only be published some time in 2008.

I am not going to release the subject of the article at this time, but will say it will be PowerShell-related.

Windows PowerShell Virtual User Group video--ONLINE!

OK, I had all kinds of problems getting the video from a recent PowerShell user group I started.  Our first meeting was October 3rd.

The raw video had to be edited, and I have problems editing the video.  PapaJohn helped me out a lot with figuring out how to edit a Live Meeting 2007 recorded session.  The final product was 100MB video file (raw was 15MB)!

I was finally able to get a place to put it: SkyDrive.  My upload sessions would time out if the file was over 30MB, so I had a lot of splitting to do.

(If I find a spot to put the entire 100MB file as one single file, I'll post an update here.)

Here's the resulting files, which I've split up by presenter (each is roughly 15-25MB).

  • Marco Shaw's introduction

I introduce myself, the user group.  I talk about the agenda, thank Microsoft and PowerGadgets for sponsoring this meeting, do some quick polls, then introduce each speaker.


  • Keith Hill's presentation on PowerShell Community Extensions

Keith talks about the PowerShell Community Extensions.  He talks about how many cmdlets there are per version, how the versions have grown in the number of lines, and where PSCX is heading.  Very good overview.


 

  • PowerGadgets' presenting their snap-in

Ivan from PowerGadgets gives a demo of their cmdlets.  PowerGadgets is very useful in providing a visual representations of their data.  It was a very strong demo of their snap-in.



 

  • Marc van Orsouw's presentation on PowerTab

Marc provides an overview of his PowerTab tab expansion extension to Windows PowerShell.  Definitely worth watching if you want to do stuff quicker in PowerShell.



 

  • Marco Shaw's closing

I close, thanking everyone, then open a Q & A to everyone.

 

  • Marc van Orsouw's closing discussion mostly on WMI

Marc shows his website, then we talk about his WMI explorer, and he shows a demo of it.




 

I definitely could have continued editing these files to get them almost perfect, but decided that it was time to finally release them, as there's no such thing as perfect...

I hope this all works.  Please leave a comment if I missed something or made an error.  I did want to put these up as a Flash presentation, but that didn't seem to be supported by SkyDrive.

Looking for PowerShell training?

Sapien is offering a 5 day PowerShell calls in  Las Vegas from March 17th to 21st, 2008. 

Check out the details here.  This class will take you all the way from an introduction to PowerShell to more advanced concepts.

If you're looking for an excellent training and need to get up-to-speed fast, this is a great opportunity.

If you use the referral code USERPOD, you will receive a free 4GB color iPod Nano**! 

(**The offer may be withdrawn at any time, though - so interested folks should register as soon as possible. The offer will definitely be withdrawn prior to the end of 2008.)

Wednesday, October 17, 2007

Windows PowerShell: TFM - 2nd edition due out in November

An eagerly awaited update to Sapien's Windows PowerShell: TFM book is due out in November.

I will definitely get it when it comes out! I highly recommend Sapien's books to anyone using Windows PowerShell.

See their announcement here.

PowerShell Screencast #1: JAMS application

I've just blogged on the new PowerShell Community site about a screencast I've just done on JAMS.

The post is here.

If you'd like to see a screencast on anything else related to PowerShell, leave me a comment.

Tuesday, October 16, 2007

Cool application/service: SkyDrive

Well, it seems since last week, Canadians now seem to have access to using SkyDrive.  I've heard there's a 50MB limit on file sizes.

When I have vidoes larger than that, I'll have to split them up into smaller chunks.  Hopefully, I won't have any more issues with the Live Meeting recordings like I've previously mentioned.

Saturday, October 13, 2007

NEW POWERSHELL FORUM

Don Jones just announced a new PowerShell forum at www.powershellcommunity.org.  I am going to start participating mainly on that site going forward.  I will still have PowerShell information here, but will start doing the technical stuff on the new community site.

I hope to see you there!

Thursday, October 11, 2007

Cool application/service: Xdrive

Since doing my first virtual PowerShell user group meeting, I now have a 100MB (higher quality,edited) video that needs a home.  I recently heard of Microsoft's  SkyDrive.  I tried signing up, but it does not appear to be available to Canadians.

Went out for a search, and came across Xdrive which I'd never heard of before.  This is a service provided by AOL (remember them?), and provides 5GB of free online storage!

I'm trying it out now for sharing the 100MB video online.  I'll report back in the next few days hopefully.

Wednesday, October 10, 2007

PowerShell Virtual User Group: video from meeting #1--VIDEO ONLINE

I'm still having minor issues with the video from the first PowerShell virtual user group. I'm continuing to work on things, but for now, I'm going to put up the "raw footage".

Download:

**Edit October 31st: See this newer post for the videos:

http://marcoshaw.blogspot.com/2007/10/windows-powershell-virtual-user-group.html**

[Remainder of original post removed.]

Sunday, October 7, 2007

PowerShell Virtual User Group: video from meeting #1--UPDATE

I'm still trying to piece together the video from meeting one.  I've hit this issue explained in this Microsoft KB:

When you use Movie Maker in Windows Vista to try to publish a video file of a recorded screen capture, the publishing process never finishes

I've had to get Windows Media Encoder to re-encode the original files.  Unfortunately, I still have some minor issues with using the resulting files in Windows Movie Maker to make a few minor edits.

For those checking-in for the video,  give me until around Wednesday to either put up the raw footage, or have all my problems solved.

Friday, October 5, 2007

PowerShell Virtual User Group: chat log from meeting #1

Here's the Q & A chat log from the first virtual user group meeting.

Update on the video:  I have the video, and want to edit it, to cut out some of the pauses.  I seem to be having some issues with the Live Meeting 2007 WMV files though.  I've tried 2 different video editing apps, and they are both having similar issues with the original files.  I'll either fix them up next week, or post them as-is.

Check out realDEVELOPMENT_07 coming to Halifax next week

 The Real Development tour is coming to Halifax on October 11th.  To register, go the the above address.  There are also sessions in QUEBEC CITY, WATERLOO, VANCOUVER, MONTREAL, OTTAWA, CALGARY, EDMONTON, REGINA and TORONTO (the dates and times for those other locations may be different).

Quick details:

SESSION 1: Developing Web Applications Today
In this session, you will learn about what's happening in the Web development industry in Canada and around the world. You'll then hear some real success stories, and where different Web technologies such as HTML and JavaScript are headed. We'll talk about established standards, browser compatibility and much more.

SESSION 2: Building a Better Website
To be an effective Web developer, you need the right skills. As you build out more complex Websites, factors such as security, data access, globalization, personalization and performance come into play. In this session, you'll learn how to use design patterns to take the right approach. We'll show you tips and tricks and established best practices to help build a better Website. We’ll also look at the essential tools to help you along the way.

Thursday, October 4, 2007

Local .NET user group presentation next week

I'll be doing a talk on Windows Server administration using PowerShell at the newly named local .NET user group.  The group has been renamed to Dev East and includes the previous Moncton and Halifax .NET user groups into one.

Special thanks to the Department of Computer Science at Université de Moncton for sponsoring the event.

Wednesday, October 3, 2007

PowerShell Virtual User Group: general update from meeting #1

Today's Windows PowerShell Virtual User Group Meeting went very well.  Unfortunately, I lost the chat log (forgot to save before the meeting ended).  There was a couple of questions that came up, and I will put that up here in a day or so.

124 people had signed up for the session, and I think at one point, we had a maximum of 64 people online.

Special thanks to Keith Hill (MVP), Marc van Orsouw (MVP), Ivan Giugni from PowerGadgets, and Rodney Buike from Microsoft for making this happen.

Next meeting is tentatively planned for December 4th at noon EST again.  I'm trying to get to present:

  • Jeffrey Snover: Microsoft PowerShell Architect
  • Don Jones (MVP) and possibly Jefferey Hicks (MVP): Sapien
  • Dmitry Sotnikov (MVP): Quest
  • Oisin Grehan: Nivot Ink

Hope to see you there!  Updates to follow.

IMPORTANT: Virtual PowerShell User Group update

I forgot to add the passcode required to call-in when I announced today's Virtual PowerShell User Group meeting.

Here it is:

Participant Code:  6551308 (after calling in)
USA/CANADA          1-866-500-6738 (toll free)

Tuesday, October 2, 2007

.NET Framework 2.0 hotfix that might affect PowerShell

I just noticed this Microsoft KB article:

FIX: You may notice that the memory load is very high when you run an application that is built on the .NET Framework 2.0

I've not checked how this might affect PowerShell, but this information might be useful to others.

Microsoft MVP award

I have received my first Microsoft MVP award.  I have received the award under the Windows Server - Admin Frameworks category for my community efforts around Windows PowerShell.

I want to thank Microsoft for recognizing my community efforts and providing me with the chance to expand my horizons using the MVP logo.

Monday, October 1, 2007

Virtual PowerShell user group meeting... 100 people have signed up!

The virtual PowerShell user group I announced  here has 100 people signed up!  I'm so excited.  I hope everyone will enjoy it, and be excited about future meetings I'm already starting to plan.

Friday, September 28, 2007

Guest blog post on PowerGadgets.com

I just posted a blog entry on the PowerGadgets site on using the credential object with invoke-sql and invoke-webservice.  The latter cmdlet's documentation doesn't indicate, to my knowledge, that the credential parameter is supported.

Tuesday, September 25, 2007

Howto: Invoking cmdlets within a cmdlet using C# (part III: ...using csc.exe)

In the introduction to this howto series, I mentioned part III would show how one invokes cmdlets within a cmdlet using csc.exe.  In this particular example, I'm going to show an example of when the cmdlet we are going to invoke does not derive from the cmdlet class.

As I mentioned in part II, there's a quick PowerShell one-liner to determine if a cmdlet derives from the cmdlet or pscmdlet class.

In our case, our example is from PowerGadgets where we will use their invoke-webserice cmdlet again.  This cmdlet derive from the cmdlet class so my example from part II will also work, but I'm going to use this cmdlet again to show how one can invoke a cmdlet that derives from the pscmdlet class.

In other words, this method I will use works for both types of cmdlets, so it could be seen as the better solution where one doesn't have to determine what class the cmdlet derives from before using it.

Here's the non-commented "guts" of the C# code (I've stripped the regular stuff like the pssnapin stuff), but the full C# code is downloadable here:

   1: string[] args = new string[] { "http://www.webservicex.net/WeatherForecast.asmx?WSDL","GetWeatherByZipCode","80526" };
   2: string command = "invoke-webservice -wsdl $args[0] -method $args[1] $args[2]";
   3: if (PostProcess)
   4: {
   5:     Collection<PSObject> results =
   6:     this.InvokeCommand.InvokeScript(command,false, PipelineResultTypes.None, null, args);
   7:     foreach (PSObject p in results)
   8:     {
   9:          WriteObject(">>> " + LanguagePrimitives.ConvertTo(p, typeof(string)));
  10:     }
  11: }
  12: else
  13: {
  14:     this.InvokeCommand.InvokeScript(command,false, PipelineResultTypes.Output, null, args);
  15: }

We setup our environment in the same way I explained in part II:



   1: PSH> $framework=$([System.Runtime.InteropServices.RuntimeEnvironment]::GetRuntimeDirectory())
   2: PSH> set-alias csc "$($framework)csc.exe"
   3: PSH> set-alias installutil "$($framework)installutil.exe"
   4: PSH> $ref=[psobject].assembly.location
   5: PSH> $pg="c:\program files\powergadgets\"
   6: PSH> $pg1="$($pg)powergadgets.commands.dll"
   7: PSH> $pg2="$($pg)powergadgets.data.dll"

 


(NOTE: Again from part II, this is to get you going quickly, most do not recommend you use DLLs from the GAC as I do above with how I create the "$ref" variable. Problem is, you need to go and download a huge SDK otherwise, which you should do if you do regular PowerShell development.)

Now, we are going to compile the cmdlet, load it, then run it. I provided the link for the full C# source code above which you will need to go and get:


PSH> csc /t:library /r:$ref /r:$pg1 /r:$pg2 invokewebservice2.cs
PSH> installutil invokewebservice2.dll
PSH> Add-PSSnapin InvokeWebService2
PSH> invoke-webservice2
Latitude         : 40.54729
Longitude        : 105.1076
AllocationFactor : 0.008857
FipsCode         : 08
PlaceName        : FORT COLLINS
StateCode        : CO
Status           :
Details          : {WeatherData, WeatherData, WeatherData, WeatherData...}

 


Now, if you're cycling through all of my examples, I've named the resulting cmdlet invoke-webservice2, so you're going to get a name conflict if you don't unregister the .DLL you might have created from my other examples or rename the namespace and the cmdlet name in the .cs file before you compile.


Again, the same warning applies here about where you decide to put your .cs file and resulting DLLs.  Please read part II again, if you're not sure what I'm referring to.


Success!

I've just shown one way to invoke a cmdlet from within another cmdlet.   You can use this method when the cmdlet you are invoking derives from the cmdlet or the pscmdlet class. In one of my next postings, I'll show you how to do some of this from with Visual Studio 2005 C# Express.

Monday, September 24, 2007

Windows PowerShell Virtual User Group Meeting!!!

Windows PowerShell Virtual User Group Meeting 

Time: October 3rd, 2007 at 12PM (noon) EST (New York time)
Place: Online via Live Meeting 2007

-----------------------------------------------------------
To sign up:
-----------------------------------------------------------
Registration site: http://www.clicktoattend.com/?id=121386
Event Code: 121386
-----------------------------------------------------------

I am proud to announce a new PowerShell user group.  This user group will have its meetings done via Live Meeting with the help of Microsoft.  The intent for the first few meetings is to invite international "PowerShell superstars" to give some brief talks on what they are doing with PowerShell.

-Guest speakers**
*Keith Hill (Microsoft MVP): “We'll look at the evolution of PSCX, the challenges of open source development and take a peek at the roadmap for future versions.”
URL/blog/site:  http://KeithHill.spaces.live.com &
http://www.codeplex.com/powershellcx
*Marc van Orsouw (/\/\o\/\/) (Microsoft MVP): Marc will talk about his PowerTab add-on to PowerShell.
URL/blog/site: http://www.thepowershellguy.com

-Vendor spotlight**
PowerGadgets: The vendor will talk about their PowerShell extensions.
URL/blog/site: http://www.powergadgets.com

-Agenda (all times are EST)**
12:00PM-12:10PM: Introduction by Marco Shaw
12:10PM-12:25PM: Keith Hill (MVP)
12:25PM-12:40PM: Marc van Orsouw (MVP)
12:40PM-12:55PM: PowerGadgets
12.55PM-1:00PM: Closing by Marco Shaw

Please note:
1. This will be done with Live Meeting *2007*.  Most of you will need to download and install the new client.
2. Voice-over-IP will be enabled for this call.  You should be able to hear the audio over your computer's speakerphone if setup properly.
3. International call-in numbers are included at the bottom of this message.
4. This session will be recorded for future offline viewing.
Special thanks to: Rodney Buike from Microsoft.  Thanks for helping make this a reality.

Sponsors: PowerGadgets and Microsoft Technet

**Subject to change without notice. 

International call-in numbers:
(You will be billed unless you are using a number identified as "toll free")

USA/CANADA          1-866-500-6738 (toll free)
AUSTRALIA      1-800-202-713 (toll free)
BELGIUM            32-3-400-2811
BRAZIL            0800-8911983 (toll free)
DENMARK            45-7014-0278
FRANCE            33-1-70-70-62-75
GERMANY            49-69-2222-7227
HONG KONG      852-2286-5645
IRELAND            353-1-247-5443
JAPAN            81-3-5539-5167
NEW ZEALAND      0800-448-997 (toll free)
SWITZERLAND      41-44-580-6291

Howto: Invoking cmdlets within a cmdlet using C# (part II: ...using csc.exe)

(NOTE: The formatting is a bit off.  I really believe this is due to the Live Writer code snippet plugin.  I will try to edit the post to fix it up at a later time.)

In the introduction to this howto series, I mentioned part II would show how one invokes cmdlets within a cmdlet using csc.exe. In this particular example, I'm going to show an example of when the cmdlet we are going to invoke derives from the cmdlet class.

Oisin Grehan provided me with a cool one-liner to determine whether a cmdlet derives from the cmdlet or pscmdlet class:

   1: get-command invoke-webservice |`
   2:   foreach-object {
   3:     $_.name +`
   4:     " is pscmdlet: " +`
   5:     [management.automation.pscmdlet].`
   6:     IsAssignableFrom($_.implementingtype)
   7: }

If the output from the above is false, our cmdlet derives from the cmdlet class.


In our case, our example is from PowerGadgets where I will use their invoke-webservice cmdlet (in later posts, I will do the same with their invoke-sql cmdlet). This cmdlet derives from the cmdlet class.


We're going to try to use the invoke-webservice in a new invoke-webservice2 cmdlet. I was inspired by Keith Hill's post on calling a web service from PowerShell.


Here's the non-commented "guts" of the C# code (I've stripped the regular stuff like the pssnapin stuff), but the full C# code is downloadable here:



   1: InvokeWebServiceCommand iws = new InvokeWebServiceCommand();
   2: iws.WSDL = "http://www.webservicex.net/WeatherForecast.asmx?WSDL";
   3: iws.Method = "GetWeatherByZipCode";
   4: iws.Parameters = new object[] { "80526" };
   5: foreach (object o in iws.Invoke<object>())
   6: {
   7:     WriteObject(o);
   8: }

 


Compiling from the command-line using the .NET Framework's C# compiler (csc.exe) is pretty easy and is packaged with the .NET 2.0 (and a new one with the .NET 3.5 framework), so any machine with PowerShell installed has the compiler.


Let's setup the environment:



   1: PSH> $framework=$([System.Runtime.InteropServices.RuntimeEnvironment]::GetRuntimeDirectory())
   2: PSH> set-alias csc "$($framework)csc.exe"
   3: PSH> set-alias installutil "$($framework)installutil.exe"
   4: PSH> $ref=[psobject].assembly.location
   5: PSH> $pg="c:\program files\powergadgets\"
   6: PSH> $pg1="$($pg)powergadgets.commands.dll"
   7: PSH> $pg2="$($pg)powergadgets.data.dll"



(NOTE: This is to get you going quickly, most do not recommend you use DLLs from the GAC as I do above with how I create the "$ref" variable. Problem is, you need to go and download a huge SDK otherwise, which you should do if you do regular PowerShell development.)


Now, we are going to compile the cmdlet, load it, then run it. I provide the link for the full C# source code above which you will need to go and get:




PSH> csc /t:library /r:$ref /r:$pg1 /r:$pg2 invokewebservice.cs
PSH> installutil invokewebservice.dll
PSH> Add-PSSnapin InvokeWebService2
PSH> invoke-webservice2
Latitude         : 40.54729
Longitude        : 105.1076
AllocationFactor : 0.008857
FipsCode         : 08
PlaceName        : FORT COLLINS
StateCode        : CO
Status           :
Details          : {WeatherData, WeatherData, WeatherData, WeatherData...}



(NOTE: Again, this is just quick and dirty, *before* you run the above commands, you should create a permanent directory somewhere in C:\Program Files, maybe something like "My_Cmdlets", for example, where you will place the .cs file, and create the .dll from there. Otherwise, you risk creating the DLLs in a temporary directory, then deleting them by mistake down the road.)


Success!


I've just shown one way to invoke a cmdlet from within another cmdlet. As I briefly mentioned, you can only use this method when the cmdlet you are invoking derives from the cmdlet class. In one of my next postings, I'll show you how to invoke a cmdlet when it does not derive from the cmdlet class.


Enjoy!

Sunday, September 23, 2007

Howto: Invoking cmdlets within a cmdlet using C# (part I: the intro)

As part of my involvement with the  PowerGadgets MVP program, I have seen users requesting a way to hide sensitive information.  They aren't looking for fool-proof methods, but something that at least hides plain text information like usernames, passwords and other sensitive information.

The Windows PowerShell SDK has some information on invoking cmdlets within a cmdlet.  I set out to figure out a way to create cmdlets that invoke other cmdlets using the SDK information.  I had some issues figuring out a few things, but with the help of Bruce Payette of the Windows PowerShell development team, I was able to find a working solution.

I'm going to use 2 cmdlets from PowerGadgets to show how this can be done.

I'm going to do this howto in 5 major parts.  First, I will do this with PowerGadgets' invoke-webservice cmdlet (and later do their invoke-sql cmdlet perhaps all in one post or over a few):

  1. Introduction (this message you're reading).
  2. When dealing with cmdlets that derive from the cmdlet class (using csc.exe).
  3. When dealing with cmdlets that *do not* derive from the cmdlet class (using csc.exe).
  4. When dealing with cmdlets that derive from the cmdlet class (using Visual Studio 2005 C# Express).
  5. When dealing with cmdlets that *do not* derive from the cmdlet class (using Visual Studio 2005 C# Express).

If there's any kind of demand for it, I could also shows how to do this via a screencast.

Thursday, September 13, 2007

PowerShell scripts contest (French)

The guys at PowerShell-Scripting (based in France I assume) are putting on a PowerShell scripting contest until the end of December.

Winners will be based on the total points that their scripts will get from other users.  The top 10 point scorers will win prizes such as their upcoming French PowerShell book and some other stuff.

French PowerShell book due early in 2008

Jeffrey Snover will be able to add another book to his multi-lingual selection soon enough.  I see the French guys at PowerShell-Scripting have announced a PowerShell book due out early in 2008.

New FTP automation add-on (COM)

Sapien is offering a free FTP automation library (COM interface) for automating FTP stuff from within scripting languages that have COM support.  I can't wait to try it with PowerShell!

I'm hoping to put on a few blog posts on this (if somebody else doesn't beat me to it).

RSSBus update

I've blogged about RSSBus before.  They recently released RC1 of their server and desktop versions.  Definitely worth checking out if you want to do cool things with RSS feeds.

Tuesday, September 11, 2007

New PowerGadgets build

PowerGadgets has just come out with build 1.0.2806 as of this morning.  The trial version available online is 1.0.2760.

Friday, September 7, 2007

I am a technical reviewer... part 2

I blogged in June that I was a technical reviewer for Sapien.  I just started doing a technical review of an upcoming book from Wrox.  I am under an NDA, so cannot say anything else at this time.

Friday, August 31, 2007

I am now officially a "Lazy Admin"

I have start guest blogging on PowerShell on the The Lazy Admin website.  I introduce myself, talk about the top 5 questions asked at TechEd last June in Orlando, and talk about how great PowerShell is.

I'll be blogging more on that site, and starting a screencast series on PowerShell and related products.

I was a beta tester for a PowerShell-related product

I'm a bit late blogging on this (the product is now out!), but I wanted to make sure this was recorded online. 

I was part of a restricted beta test of PrimalScript 2007 for Sapien Technologies.  I specifically tested their product for PowerShell support, and had found a few things that I quickly reported, and were quickly addressed by Sapien.

Wednesday, August 29, 2007

Attention New Brunswick Universities/Colleges

If you're an IT student or teacher at Universite de Moncton, UNB Fredericton or Mount Allison, I have tried to contact your IT department with a free offer:  To run a Windows PowerShell information/training session.

If you are from one of these institutions and are reading this blog, and think this is a good idea, leave me a comment with a contact (I won't post the comment, but will just get the contact info, then reject the comment).

[Edit: August 31st, 2007: I have been in brief contact with the IT department head at Universite de Moncton.  Nothing to report yet.]

Virtual PowerShell user group poll

I'm planning a 60 minute virtual PowerShell user group meeting.

It would be possibly either Wednesday, October 10th or 17th at noon EST (New York time). Would you attend?

Near the top right of this blog, I have a poll setup. Please take the time to enter your vote!

Spread the word!

Tuesday, August 21, 2007

Guest blogger on PowerGadgets.com

I've started doing some guest blog entries on PowerGadgets.  I talk about how to create a scrolling stock ticker with out-gauge.

I'll be blogging soon, about adding something like a flashing notification to out-gauge.  I'll also tie the two together, and also talk about drilldown support.

I also created a traffic light gadget that I'll blog about soon also.

Thursday, August 16, 2007

My first print article

I have an article or "hack" that will appear O'Reilly's upcoming  Big Book of Windows Hacks due October 2007. 

My hack is tentatively named:  “Create Custom RSS Feeds from Newsgroups and Online Forums”.  I use PowerShell and RSSBus to create some customized RSS feeds to the official PowerShell newsgroup and also the PowerGadgets forums.

Monday, August 13, 2007

powershell-developers and powershell-announcements mailing lists

Along this previous blog entry, I've created 2 new googlegroups.com groups:

1. powershell-developers
Description:
This group is meant for individuals who do development with or for
PowerShell.  It is intended to be a list for advanced PowerShell
users.
* Group name: powershell-developers
* Group home page: http://groups.google.com/group/powershell-developers?hl=en
* Group email address powershell-developers@googlegroups.com
2. powershell-announcements
Description: PowerShell related announcements go here: new books, new
forums/blogs, new user groups or an upcoming meeting, new products,
new/upcoming training. One time announcements go here.
* Group name: powershell-announcements
* Group home page: http://groups.google.com/group/powershell-announcements?hl=en
* Group email address powershell-announcements@googlegroups.com

Introducing CyberSocial.ca

CyberSocial.ca is a social gathering for IT professionals in the Moncton (New Brunswick, Canada) area.

I have been in touch with one of the organizers, and I would like to share more knowledge of Windows PowerShell with other local IT people.

At one of the next get-together's (possibly mid-September), I will try to get on the "soapbox" for 2 minutes where I can talk to all of the attendees.

During those 2 minutes, I plan to give a very general introduction to Windows PowerShell, and try to gather some feedback on whether the group would be interested in a 2 hour (possibly 2.5 or even 3 hours) workshop on Windows PowerShell.

If you've come here specifically to read this blog post, and have attended the previous cybersocials, please leave a comment here on my blog.  Whatever you say won't be posted.  I will just get an email with whatever comments you may have added, then I'll delete your comments once I read them.

Hopefully, PowerShell is something of interest to everyone that uses a Microsoft operating system, especially their server products.

Thursday, August 9, 2007

powershell-users mailing list

I've just created a 'powershell-users' group within Googlegroups. 

What this gives the PowerShell community is a general mailing list for everyone to join.  Google account required, but hopefully that won't be much of an issue.

I've considered creating a 'powershell-nntp' or such group, but with RSS being what it is today, that is likely a much better solution (having an RSS reader to take care of such things).


I am hoping this mailing list will be useful to users in general.

Group name: powershell-users
Description: Windows PowerShell users. This is mainly a group for Windows PowerShell users such as system administrators, database administrators, and anyone else interested in PowerShell.
Group/web address:
http://groups.google.com/group/powershell-users
Current email address:
powershell-users@googlegroups.com

Feedback/comments are always welcome.

An example of using LINQ from PowerShell

I noticed this blog entry providing an example of using LINQ to read an RSS feed.  Having come across LINQ before, and being curious, I had to give it a try.

You need the .NET 3.5 framework, currently at beta 2, which installed nicely.

I don't foresee the latest framework causing any issues with PowerShell, as I believe 3.5 is similar to 3.0, and is only seen as extensions added to the 2.0 framework for the most part.

3.5 does seem to come with new C# and VB.NET compilers though.

Wednesday, August 8, 2007

PowerGadgets

Have you had the chance to try out PowerGadgets, which are cmdlets that can be used to create rich graphical representations of data?  You can use it to create charts, gauges and even maps.  They also provide some other useful cmdlets to send mail, connect to an SQL data source and connect to a web service.

Think about it...  A simple gauge style gadget in your Vista sidebar that gives you utilization of a remote server and/or application.  If you're wanting to watch something remotely, and now that you can get the information you want via WMI.  To keep an eye on a WMI value, for example, you can pipe that to a PowerGadgets cmdlet and have that available in your sidebar with Vista.

Check out this cool example of using PowerGadgets and Operations Manager 2007 to create a sidebar showing the alerts within OpsMgr.

Check out their 60-day trial.

If there's anything you ever wanted to try with PowerGadgets, but either weren't sure if it was possible or how you would proceed, drop me a comment here, and I'll make sure to answer any questions or pass them along to PowerGadgets.

I've previously mentioned their PowerGadgets MVP program that people may qualify for.

New PowerShell Remoting beta

/n software has released beta 2 of their PowerShell Remoting product.  What this gives you is full access to remote PowerShell sessions.  I'm not just talking about the remoting capabilities that using WMI via PowerShell can give you, but complete *objects* that are passed along remotely.

Saturday, July 28, 2007

PowerGadgets build 1.0.2760

A new build of PowerGadgets was released recently to address a few minor issues that came up on the support forums.

Definitely worth going with a the latest release if you are seeing/getting any unexpected results.

PowerShell Podcast

Along with Sapien, I'm going to put up a link to

Jonathan Walz's PowerShell podcast site.  He mentions my site in his latest edition, and that I'd like to start a Canadian PowerShell user group.

Saturday, July 21, 2007

PowerGadgets updates

PowerGadgets just released version 1.0.2755 (currently build 1.0.2755.24126) of their cmdlets.

Juan also just published a super blog entry on using conditional attribute parameters with their out-chart gadget.  These parameters have just been recently modified to be able to use scriptblocks!

You need to check PowerGadgets out if you haven't already.

You will find good support online to get you going, and I am always willing to try to lend a hand to anyone.

Thursday, July 19, 2007

Custom maps with PowerGadgets

PowerGadgets' out-map cmdlet allows you to create your own "maps" to visually represent data.  I've blogged before about how I used a view of a World map to represent some data.

Following a PowerGadgets team blog entry, I've decided to play with a traffic light type of map to address a feature request from several months back in the PowerGadgets community forums.

So here you have a very basic traffic light gadget:

Unfortunately, using a true circle is not supported, so creating a square/rectangular light is the path I took.

The possibilities of using PowerGadgets for visualizing custom data are almost limitless.  Check out this out-map view of an airplane!.

Tuesday, June 19, 2007

PowerGadgets MVP program

PowerGadgets has come out with an MVP program that offers a free NFR license for qualified individuals.

Quote: "Are you an influential IT professional, software vendor, UG leader or technology reviewer? Let us know and we may provide you with a FREE NFR copy of PowerGadgets."

You simply fill out a form online, and you should be contacted within a few days.

This is definitely a good way to spread the word.

Thursday, June 14, 2007

Canadian PowerShell User Group

Anyone from Canada interested in starting up a Canadian PowerShell user group, please contact me by leaving a comment with your contact information. 

(I'll contact you directly without approving your comment, that way your comment & contact info won't appear here so I can't be blamed for any spam!)

Monday, June 11, 2007

Free PowerShell training in Moncton, NB (Canada)

I live near Moncton, NB (Canada).  I am offering free Windows PowerShell training to any one/any groups looking for in-house training.  Contact me if you're interested by adding a comment here.

My free offer is only available outside of regular business hours though.  For training during business hours, I would have to charge a fee (to replace my normal wages).

I am a technical reviewer...

Due to an NDA, I cannot release much information, but I can mention that I have been accepted as a technical reviewer for a new book from Sapien Technologies.

Thursday, June 7, 2007

PowerShell Remoting example

Just an example of running the new PowerShell Remoting product from /n software

What I'm doing below is SSH'ing to a remote server to run a single command.  I'm returned an object which I then use to further parse after.

I'm just querying a remote server for win32_processor to get the average load percentage of each CPU (4 in this example).

I could easily pump this value into something like PowerGadgets to keep an eye on the CPU utilization.

84# $load=invoke-ssh -server xxxx -user xxxx -password xxxx -command "gwmi win32_
processor" -timeout 30
Do you want to trust the certificate presented?
The server has presented the key below:
Fingerprint: B8:C5:E0:AA:AB:48:D4:F9:3D:D6:5B:FD:9C:5B:40:B6
[Y] Yes [N] No [S] Suspend [?] Help (default is "Y"):
85# ($load|%{if($_.text -like "*loadpercentage*"){$_.text}}).count
4
86# $load|%{if($_.text -like "*loadpercentage*"){[int]$loadt+=[int]$_.text.split(':')[1]}}
87# $loadt/4
1