The Mystery of the PowerShell “alias”

So… I have a situation, and I’m not really sure what’s going on.  I think this is a two-fold problem:

Problem 1: Variable and Alias – Odd Things – There’s a Ghost in the (Power)Shell

To set the picture, I’m running Windows PowerShell 5.0 on Windows 10, but we also saw this on Windows PowerShell 2.0 in Windows Server 2008 R2.  When I type alias, it outputs contents as if it were running Get-Alias.

alias1-20151103

My instinct tells me this should be an alias.  So let’s see:

alias5-20151103

Nope… not an alias.  Is this a variable?

alias2-20151103

Nope… not a variable.  Is this a command?

alias3-20151103

Nope…. not a command. Is this a function?

alias4-20151103

Nope.  Is this an executable that cmd can run?

cmdexe-20151103

Nope.  We also see this phantom listing (for lack of a better term) with variable.

So… problem 1 – what are these things if they aren’t commands, aliases, variables, or  functions?  June and I tested these with PowerShell v2.0 on Windows Server 2008 R2 and PowerShell v5.0 on Windows 10, natively.  We also tested it in versions 2.0, 3.0, 4.0, and 5.0 side-by-side.

Problem 2. The Shadow of the Phantom (not the Opera)

So piggybacking off of #1, I have an odder situation.  I have a custom PS module that I’ve created for teaching – originally used in 2011 and repurposed for Coding 101 this past October.  June changed my line #1 to include -Name and -Value (but this doesn’t make a difference).  I have an issue with the alias scenario above, coming from a Linux background.  The command alias by itself is used for creating aliases, so I like to fix the alias with the proper usage:

alias6-20151103

PowerShell is not auto-loading this module, but we can load it with Import-Module and the alias alias works as expected.

Is our phantom friend from #1 shadowing my module, preventing it from auto-loading?  If so, is this a bug?  Or is this possibly an undocumented feature?  (What…?!? I’m a dev. I had to put it that way. 🙂 )

UPDATE – The Mysterious 2nd Pass

So I asked about this on Twitter, and I got responses from the PowerShell community – thanks to Bruce Payette, Boe Prox, and Lee Holmes.  Basically, as Bruce Payette explained it, since PowerShell v1.0, when a command is executed, PowerShell does a 2-pass find:  first it looks for the command by name, and if that fails, then it does a second pass with Get- prepended to it.  So…

  1. alias is looked for but not found.
  2. Get-Alias is looked for, found, and executed.

Boe Prox  blogged about this behavior and how he sniffed it out with the Trace-Command cmdlet.

Lee Holmes explained that auto-loading a module happens if CommandNotFound is about to get thrown.  However, because of this second pass, CommandNotFound doesn’t get thrown, so the module does not auto-load.

And this… this is why I love the PowerShell community.  They’re super helpful and can shed light on issues even with 140 character limits on Twitter. 🙂  Thanks, guys!

Happy International PowerShell User Group Day!

Today, techies throughout the world are celebrating the awesomeness of PowerShell with International PowerShell User Group Day.  Some people are quick to dismiss it as an IT admin tool, but there are other people besides sysadmins who use PowerShell.  I can think of a SharePoint guy, a few SQL Server guys, and yes, even developers, who have embraced the power of PowerShell.

PowerShell Community Groups

There are user groups throughout the world to celebrate discoveries and share scripts done in PowerShell.  Yes, I did say “throughout the world”.  Let’s take a look at the list at PowerShellGroups.org.  Besides the US, I see groups in Denmark, Egypt, UK, Norway, India, and Singapore.  For those who do not have a user group close, there’s even a Virtual Group!

Sponsors of Today’s Celebration

Today’s celebration of PowerShell user groups has been talked about throughout the PowerShell community.  They’ve even gotten some familiar faces in the community to sponsor the day.  So let’s thank these companies for helping make today a success:

Special Meetings

There are special meetings today for user groups to tune into presentations by PowerShell MVP/author/columnist Don Jones, Microsoft’s Hey Scripting Guy! Ed Wilson, and many others.  Special thanks to Interface Technical Training for providing the Remote Live platform for delivering this talk.   The meetings themselves will be broadcast at:

  • 1st broadcast – 12:00 PDT (19:00 Zulu)
  • 2nd broadcast – 15:00 PDT (22:00 Zulu)
  • 3rd broadcast – 18:00 PDT (01:00 Zulu)

To catch these presentations, check out your local PowerShell user group.

Happy International PowerShell User Group Day!

Intro to PowerShell @ MIGANG – Notes from 2/15 Presentation

On February 15, I was privileged to speak at MIGANG on PowerShell. As true with most of my PowerShell presentations, there are no PowerPoint slides for this presentation, just a custom module that has my comments on various topics.

The custom module is a manifest module, as I generated a PSD1 file for the module. However, if you remove the PSD1 file, the module is then considered to be a script module, as was covered in the talk.

To give you some background, my $profile has the following setup:

Set-Alias alias Set-Alias

function Get-Home{
    cd ~
}

$PSModulePath = $env:psmodulepath

I use the alias example because it disturbs me that there are some Linux commands that are already aliased, but the obvious alias alias was left out.

The function Get-Home is referenced in one of my help files. There’s a story behind this one. Again, this goes back to my Linux/Unix background. While Matt and I were working on our book, he had an example of a custom function that would get the user’s home directory. He used some long, convoluted path after the cd command. Of course, I had to come back and explain to him what the ~ meant, as I used to type cd ~ a lot when I spent time in the Unix labs on campus in my college days. It wouldn’t be until later on, as I was preparing for this talk, that I found the ~ explained in a PowerShell help file. (It’s in Example 1 of the help text for Resolve-Path.)

Finally, I included the $PSModulePath variable for two reasons. One, there’s improper documentation that this variable is a pre-defined variable. There are community comments that point out this flaw. The other reason is so that I can use the environment variables as a good segue into the providers topic.

I noted that I was not really going to get into covering creating custom providers, as there is a lot of detail behind that. However, if you want to talk providers, Oisin Grehan is a PowerShell provider master. He is also the guy behind the PowerShell Script Provider, to allow writing PowerShell providers in PowerShell scripting language and not necessarily in C#.

The other recommendation that was mentioned was to use the #PowerShell hashtag on Twitter, as there are many awesome PowerShell MVPs and notable people who work with it who are gratiously answering questions and helping as needed, providing direction for learning more on PowerShell.

You can download the custom MIGANG-Feb2012 module here.

If you have PowerShell already installed, then here are the steps for using the module:

  1. Start PowerShell (ISE or console).
  2. Extract the zip file into one of the Modules folders in $env:PSModulePath.
    Mine has the following values:

    C:UserssdutkiewiczDocumentsWindowsPowerShellModules;
    C:Windowssystem32WindowsPowerShellv1.0Modules

    The best command I’ve found to see this in PowerShell is:

    dir env:PSModulePath | select Value

  3. Run the following command:

    Import-Module MIGANG-Feb2012

  4. Getting started with the module, run: Get-Help about_KeyTerms for more information.

I briefly ran through creating custom cmdlets in C#. In our book, I wrote about cmdlets to work with the Windows 7 Libraries feature – the feature that deals with Documents, Music, Video, Pictures, Contacts, and Downloads. The code that I used for that part will most likely be included in supplemental materials for our book. You can order the Automating Microsoft® Windows Server 2008 R2 Administration with Windows® PowerShell 2.0 book through a variety of vendors.

I had a lot of fun presenting to such a lively crowd, and I especially enjoyed talking with others at Copper Canyon afterwards! Thanks to all who came out for it!

Using StudioShell to generate WiX XML

I have to say it – after seeing Jim Christopher‘s StudioShell talk at devLink this past year, I think it’s been my most favorite Visual Studio tool so far.  I get to use my PowerShell knowledge to help script stuff out, saving my teammates a ton of work.  Today, we added about 10 new pages to one of our client’s sites and had to update a WiX installer.  Recognizing patterns and an opportunity for PowerShell, I just had to use StudioShell to eliminate the tediousness of generating the XML code manually.

Background

We have a Visual Studio 2010 solution with numerous projects – class libraries, WiX installers, and at least one web application.  One of the annoyances we have on our team is maintaining the WiX files every time we update a page, in order to make sure our pages get deployed properly.  So imagine our frustration today, after adding about 10 pages of content to our web application, we realized that we had to update our WiX installer for the website.

For those not familiar with WiX – Windows Installer XML (WiX) is what’s used in creating MSI files from XML.  You can use the WiX toolset to help you maintain these packages.  The WiX toolset documentation is available on SourceForge.  Every time we need to add a file to the server, we have to update our WiX wxs file.  Syntax for that looks something like this:

<File Id="SampleFile.aspx" Name="SampleFile.aspx" Source="$(var.OurSamplePath)SubfolderSampleFile.aspx" />

Problem and Solution

Our problem was that we needed to create that line for 10 new ASPX files.  Sure, we could have borrowed a line from one of the files already in the directory, copied and pasted it 10 times, and then manally search-and-replaced each of these instances.  But even that takes a long time.  Knowing what I did with what tools I had available, this is how I saw it.  That XML above pretty much boiled down to this for me:

<File Id="{0}" Name="{0}" Source="$(var.OurSamplePath)Subfolder{0}" />

I saw that pattern and realized I could turn that into a string and pass it the names of the files.  I also realized that I could use StudioShell to navigate through my project’s structure to get a list of the new files – which happened to be all of the ASPX files in a particular director and output them into this XML.  My StudioShell commands looked something like this:

cd DTE:
cd solutionprojectsProjectNameSomeSubFolder
dir *.aspx | % { "<File Id=`"{0}`" Name=`"{0}`" Source=`"`$(var.OurSamplePath)Subfolder{0}`" />" -f $_.Name }

The StudioShell output looked something like this:

<File Id="AgeGroups.aspx" Name="AgeGroups.aspx"
Source="$(var.OurSamplePath)SubfolderAgeGroups.aspx" />
<File Id="Fees.aspx" Name="Fees.aspx"
Source="$(var.OurSamplePath)SubfolderFees.aspx" />
<File Id="Home.aspx" Name="Home.aspx"
Source="$(var.OurSamplePath)SubfolderHome.aspx" />

What took me a few minutes to type the command, run, copy the output, and paste into the wxs file could have easily taken longer if I hadn’t had StudioShell.

Note: While I could have fired up PowerShell and navigated my code via the FileSystem provider (as the dir command and the string formatting are PowerShell), I preferred to use StudioShell because our projects in the solution were in different folders and having the DTE:solutionprojects navigation that StudioShell made it that much more easier and convenient to just do this work from within Visual Studio.

Conclusion

Once again, having StudioShell as part of my installed Visual Studio tools made it that much easier for me to script out a process and get the results I needed within a much shorter period of time than doing it manually.  If you haven’t checked out StudioShell yet, you can find it at http://studioshell.codeplex.com.

Ann Arbor Day of .NET 2011 Recap

Yesterday, I was up in Ann Arbor, Michigan for their Day of .NET event at Washtenaw Community College.  I wanted to thank some of the organizers – Jason Follas, Jay Harris, and Scott Zischerk – for making this happen.  I know how much work it takes to get one of these together, and without them, we wouldn’t have had an event in the first place.  Also thanks to the sponsors – Telerik, TechSmith, ComponentOne, and Applied Innovations – as they also made contributions to help make this a great event.

It was great to see so many of my friends yesterday, and it was great to see at least one speaker outside of the Heartland District.  I was glad to see David Hoerster made it out from Pittsburgh!  For me, I wanted to catch sessions that I’ve been meaning to catch for awhile or sessions that I could learn from to apply to my current projects.  Here’s what I caught yesterday.

Dealing with Data in a Mobile Application, presented by Jeff Fansler

In this presentation, Jeff talked about consuming data, storing data, and caching data.  We looked at sync vs. async and how those worked.  When it comes to storing data, Jeff mentioned three options – isolated storage, Sterling DB, and – now with Mango – SQL CE!  I was already familiar with isolated storage, since I’ve used it in my Silverlight apps.  However, I hadn’t seen examples of Sterling, and his example would have been a good guide for that.  I was a little bummed that there wasn’t a SQL CE example, as I have an app that I’m working on that would benefit from SQL CE.  But alas, I’ve got something new to learn!  The last thing Jeff covered was saving data – both on demand and as a background task.  Overall, I really enjoyed this talk and have a lot to take away from it.  If you were at AADODN and didn’t catch this, you can catch it again at CodeMash!

Going Independent, presented by Michael Eaton

As you may know, I have gone independent, as of August.  I’ve got a couple clients that I’m working on now, and I’m learning to balance my work demands and my life demands.  I caught this session at devLink this past August, and although I had already asked Mike for advice before this, I still learned a bit from it.  As he mentions – when you go independent, you typically aren’t 100% billable – you can’t really bill for invoicing, other accounting business, and other administrivia.  He also mentioned a bunch of other helpful tidbits for those getting started on going on their own.  Like he said in his presentation, the ideas he covers in his presentation are based on what he has experienced in this past decade, and each indie has a different story.  If you didn’t catch this session, it will be done as a PreCompiler at CodeMash!

Develop IT: Intro to PowerShell, presented by Sarah Dutkiewicz

I was asked by Jay Harris awhile back if I would consider submitting this talk to Ann Arbor Day of .NET, and since it’s my favorite talk to give, I was happy to oblige.  Once again, this session was for a packed room, with an interesting audience.  This time around, I didn’t speak to my help files as much as I have in the past.  However, I did continue to keep this slideless and work from a custom module.  You can download the module from http://qtlil.me/aadond2011ps.

I also managed to cut a little bit out so that I could mention Jim Christopher‘s StudioShell.  As a developer with a little bit of PowerShell background, you can make this tool work for you in ways you couldn’t imagine.  For example, we have a client who stored error messages in a class, but our business analysts wanted to maintain those messages.  Rather than manually creating the XML file that we had envisioned, I had one of my teammates show me what he was looking for format-wise, and I got it for him in a matter of minutes.  Most of the minutes were me waiting to install StudioShell in my VM – otherwise, with one line of code, I was able to extract the constant string variables’ names and values and put them into an XML file.

If you haven’t caught this presentation yet, I’ll be giving it in the Detroit, MI-area at MIGANG on February 15.  If you’re interested in hearing it at your user group, please contact me at sarah at codinggeekette dot com.

Stone Soup or Creating a Culture of Change, presented by James Bender

It was great to wind down from the conference with this session. Throughout this session, James talks of how to deal with change in a company.  One of my recent favorite phrases was near the beginning of this presentation – Change where you work or change where you work.  If things aren’t going the way you like, you can try implementing change in the workplace to  make things better.  For example, maybe you work at a company that seems to hesitate with developer training.  Rather than letting them slack in that department, you could encourage your teammates to learn by doing lunch’n’learns.  But let’s say that the company seems to be lacking in ways that you can’t change.  Then maybe it’s to change your work in terms of finding a new place to work.  This is one of many phrases and stories that James’ presentation suggests.  Unfortunately, he is retiring this talk for now.  But if you find yourself trying to initiate change in the workplace and have troubles, James is a good guy to talk with about that.

Conclusion

I unfortunately didn’t stay for the closing ceremony, as I needed to get on the road for a 3 hour ride back to Cleveland.  However, from what I’ve been able to experience, Ann Arbor Day of .NET once again turned out to be a great event, well worth the 6-hour total travel time.  I’m glad I drove up for it!  Thanks again to those who organized the event and made the event happen!

If you, my readers, haven’t had the chance to attend a Day of .NET event, you’re missing quite a bit.  Typically, for a small fee (approximately $10 nowadays), you can get a day’s worth of training from regional experts on a variety of topics.  It’s a great event to learn something new.  It’s also a great event for networking with those in the community, finding other people who have the same problems as you or who have had your problem and may have a solution.  You can always find more on Days of .NET at http://dayofdotnet.org/.  Hope to see you at one in the future!

PowerShell Not Your Father’s Command Line Part 29 of 31: Demystifying MSDN and PowerShell static syntax

Originally, this post was going to be about GUIs, but after waking up this morning and seeing a comment on Part 28, I figured that I’d address that comment in this post.

Paul Bendall writes:

But how does an ITPro without a developer background start to use MSDN and understand terminology such as static, override, []::Something?

Let’s demystify some of the things at MSDN so that maybe you guys without a developer background can make sense of it.

Terminology Elevator – Ground Floor – Objects

Objects are… um… objects in programming terminology. An object could be words, numbers, a computer, anything really. In Appendix B in our book, I talk about objects at a really high level. Let’s take a similar approach here. Let’s talk about a keyboard.
Rapoo Keyboard from Hong Kong
A keyboard is an object. It has keys – which means that a keyboard could have a collection of objects. Yes, collection can be a technical term referring to a grouping of like or related objects. Now let’s look at a keyboard key… what can you tell me about it?

  • What color is the key?
  • What character or characters are on the keys?
  • How big or small is the key?
  • Is the key enabled?

The answer to these questions would be called properties of the keyboard key. They describe the object in terms of adjectives and capabilities.

  • Press the key.
  • Release the key.

These actions show that the key can respond to events. When an event happens, you can trigger a piece of code to run. In some cases, you may be able to have code run before or after an event happens, depending on the object and event.

Now let’s look at the Caps Lock key. When you press it, the alphabetical keys TYPE CAPITAL LETTERS. This means that not only can this key respond to being pressed, but it also can perform an action called a method. Yes, this also means that the object may call a method while responding to an event.

So an object can have properties, methods, and events.

Terminology Elevator – Level 1 – Class, Static, and Constructor

A class is a container that holds the methods, events, and properties of an object. Using our keyboard key example, a class would be the collection of all of the properties, methods, and events that belong to a keyboard key.

If you find yourself using the New-Object cmdlet and getting the “Constructor not found.” error, that basically is telling you that you are working with a static class.

A constructor is a piece of code that states how to create a new object. This is the piece of code that gets run when an object is created with the New-Object cmdlet.

If the constructor isn’t in the class, then the class is considered static. If something is called static, this means that they are not created, destroyed, or changed – they are simply used.

In PowerShell, the :: operator is used to call out to static methods and properties. The syntax is as follows:

[Namespace.Namespace.ClassName]::Method()

or

[Namespace.Namespace.ClassName]::Property

Yesterday, we looked at the System.Windows.Forms.SystemInformation class and some of its properties. There is also a TechNet article on using static classes and methods in PowerShell.

Terminology Elevator – Level 2 – Assemblies and Namespaces

Assemblies and namespaces are ways to organize code. An assembly is a physical way of organizing code – commonly in a DLL file. A namespace is a logical way of organizing code – grouping code for the same object or collection of objects together.

Looking at the top of the SystemInformation class page on MSDN, you can see that this particular class lives in the System.Windows.Forms.dll assembly. It also belongs to many namespaces – collectively, it belongs to System.Windows.Forms. However, Forms is a namespace that belongs to Windows, which is a namespace that belongs to the System namespace.

Russian Matryoshka dolls - pic taken from http://nelietatravellingadventures.blogspot.com/2010/11/matryoshka-or-nesting-dolls-from-russia.html
One thing you’ll notice with the naming scheme is that the namespaces are stacked like Russian matryoshka dolls – the largest namespace is on the outside, and the smaller namespaces are nested inside, all the way down to the class – which is like that tiny doll at the end.

Terminology Elevator – Observation Deck – Overrides

By default, there are actions that a command can do automatically. However, you may want to customize those actions, which can be done by overriding the action. Basically, if you write code that overrides the default behavior, your code supersedes the default code.

Conclusion

A lot of what you’ll see on MSDN is based on object-oriented programming concepts. Hopefully this post gives you a little idea as to what those terms mean and can help you on your way in using static classes and methods in PowerShell.

PowerShell Not Your Father’s Command Line Part 28 of 31: What is the .NET Framework?

While talking with Hal and Jonathan on the PowerScripting podcast, I was asked the question “What is .NET?” Of course, I mentioned that it’s a framework, but then I choked… the .NET Framework is a huge thing to try to tackle like that, especially when talking with IT pros. Being a developer and working with the .NET framework, I can tell you it’s a collection of libraries that have a whole lot of code that we don’t have to write and can use to make our developing a lot easier. However, I didn’t need to get into it as a developer and needed to suppress the developer speak.

What is the .NET Framework?

When I say that the .NET framework is huge, I’m referring to how much it covers – be it web services, web applications and websites, desktop applications, or yes, even shell scripts. There are libraries – collection of objects and commands – to make it easy to access data, manage configurations, work with accessibility and assistive technologies, address security concerns… just to name a few things that you can do.

What is .NET Framework in terms of PowerShell?

Sean Kearney, a.k.a. The Energized Tech, recently wrote a post titled Understanding .NET from the perspective of an IT Professional. In that post, he talks of assemblies, which developers are quite familiar with. If you have to support developers and they happen to ask you which assemblies are installed on your machine, you could use this:

[appdomain]::CurrentDomain.GetAssemblies() | Select FullName

This command will list all of the assemblies in the current domain. Each assembly listing includes the name, version, culture, and public key token; these fields are key to developers as they need to use those lines when configuring their .NET projects that may live on your server.

The output may look something like this:

PresentationFramework, Version=3.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35

If you want to work with an assembly that isn’t loaded by default, you could use the Add-Type cmdlet in PowerShell 2.0. For example, let’s say we’re writing a script that gets a computer’s NetBIOS name, the logged-in user’s user name, and the domain. These can easily be accessed by System.Windows.Forms.SystemInformation. To see these details, run the following commands:

Add-Type -AssemblyName System.Windows.Forms
[System.Windows.Forms.SystemInformation]::ComputerName
[System.Windows.Forms.SystemInformation]::UserName
[System.Windows.Forms.SystemInformation]::UserDomainName

And as suggested by Aleksandar Nikolic, here’s a good way to see what static properties and methods belong to the SystemInformation class:

[System.Windows.Forms.SystemInformation] | Get-Member - Static

As you can see, you can use these .NET assemblies from within PowerShell, as PowerShell is built on top of the .NET Framework.

If you have questions about Add-Type, I’d first recommend checking out:

Get-Help Add-Type -examples

Learning More

As I mentioned, the .NET Framework is huge enough to have its own podcast. You can find out more about .NET in the community through the .NET Rocks! podcast, hosted by Carl Franklin and Richard Campbell (one of the co-hosts of the IT pro sister show called RunAs Radio).

Someone else listening to the podcast suggested reading MSDN. My advice – just be familiar with the MSDN Library and how to search it as needed. You’ll find this to be a great resource, especially if you’re going to write your own custom compiled cmdlets, providers, and binary modules.

This was just a high level overview of what the .NET Framework can do. If you want to see more things you can do with the .NET Framework, check out some of the fun projects over at Coding4Fun!

Matt and I want to hear what you’ve thought about the series so far. Leave us comments on our posts or get in touch with us. I can be emailed at sarah at codinggeekette dot com.

Special thanks to Aleksandar Nikolic for catching the typo in this entry. The Add-Type command has been updated.

PowerShell The Community’s Command Line Part 27 of 31: It Takes a Community to Raise a Language

Much like the saying It takes a village to raise a child, it takes a community to raise a programming language. Without passionate people in that community, the word won’t spread and a language can die. Yesterday, I talked about some of the cool community resources and sites. Today, I want to salute those who are working on community projects with PowerShell. These are just a few of the many out there.

StudioShell, by Jim Christopher (@beefarino)

http://studioshell.codeplex.com/
StudioShell is an integrated PowerShell host available inside Visual Studio 2010 and 2008. This tool exposes Visual Studio’s extensibility points and makes it easier to extend your Visual Studio from the command line rather than from compiled binaries. Jim will be giving a presentation on his StudioShell project and using it to extend Visual Studio at CodeStock 2011 down in Knoxville, TN this June.

MongoDB PowerShell Provider, by Jim Christopher

http://mosh.codeplex.com/
If you’re in an environment where you need to manage a Mongo database, then the MongoDB PowerShell Provider may make your life a little easier in managing the database from within PowerShell. This project is nicely documented both on the CodePlex site and from within PowerShell.

PowerShell Script Provider, by Oisin Grehan (@oising)

http://psprovider.codeplex.com/
While developers who can think out a provider’s logic may be more comfortable with writing the provider in C#, this provider allows IT Pros and those comfortable with PowerShell to write their providers in the PowerShell scripting language. Oisin Grehan, PowerShell MVP and PowerShell provider guru, is the guy behind this project. It’s great to see the option of writing providers in PowerShell, as working with the scripting technology directly in its own language makes more sense to many scripters.

Show-UI: The PowerShell WPF Toolkit

Show-UI
For those who have our book, disregard the recommendations on page 397 on the two things to help with WPF apps in PowerShell, as WPK and PowerBoots are merging. Show-UI is the project that they are merging into. Yes, you can use PowerShell to create GUIs. Show-UI is a project that can help make that process even easier in PowerShell. Shoutouts to the coordinators and developers – Jaykul, Doug Finke, and James Brundage.

Others?

Got any other PowerShell projects that you want to share? Leave me a comment!

PowerShell My Father’s Command Line Part 26 of 31: Start Spreading the News…

I’m watching this week’s episode of Glee again while writing this post, and the “I Love New York/New York, New York” mashup really inspired this title. I have to give a shoutout to my dad in the title, as while he isn’t technologically inclined, he taught me the value of networking and establishing relationships. He was a union leader for the city’s emergency response service for many years, and in those years, I watched as he networked with people in his line of work and those who impacted his line of work – councilpeople, mayors, senators, and the like. Watching him, I learned how to network and how to participate in communities.

Up until this point, Matt and I have been talking about scripts and code in PowerShell, but there’s more than just that. If the language didn’t have a community behind it, it would fall flat and not continue on like it has been. So let’s do a shoutout to some of those in the PowerShell community!

2011 Scripting Games

Hey, Scripting Guy!, the Scripting Games, and the Scripting Wife!

Ed Wilson is also known as the Scripting Guy over at Microsoft. He answers languages on various scripting technologies, with PowerShell being the focus nowadays. Whether he’s answering questions in the Hey, Scripting Guy! blog, posting on Twitter as @scriptingguys, speaking at various events throughout the world, or writing books, Ed is a great community resource when it comes to PowerShell! One of the events that he promotes on his blog are the Scripting Games, and the 2011 Scripting Games were no exception! This is a great contest for testing your scripting chops against other PowerShell scripters, competing in either a beginner or advanced level. What made it even neater to follow this year was that Scripting Wife joined the games. While I didn’t have time to participate this year due to other timing conflicts, I did enjoy reading the journeys of Scripting Wife as she learned working with PowerShell. Check out the Hey, Scripting Guy blog, as Ed covers some of the topics that you’ve probably wondered about.

PowerScripting Podcast

PowerScripting Podcast

Hosted by Hal Rottenberg and Jonathan Walz, the PowerScripting podcast is recorded live on UStream every Thursday night at 9:30pm Eastern Daylight Time (GMT -4). They feature various people in the PowerShell community – including talking with Jeffrey Snover (father of PowerShell), the directors of PowerShellCommunity.org, PowerShell MVPs, people on the PowerShell team, vendors of PowerShell products, and even those on product group teams whose products can benefit from PowerShell. While recording, they’ll take questions from the audience via the chat channel. I was able to catch the show on PowerShellCommunity.org, and it was neat to see how they record the podcast. After recording the show, the hosts play music while wrapping up the show – always great to rock out with these guys! Matt and I will be on PowerScripting tonight talking about our book and our love of PowerShell!
PowerShellCommunity.org

PowerShellCommunity.org

Run by the community for the community, PowerShellCommunity.org features news, forums, learning resources, steps for forming a PowerShell user group, and a poshcode.org-powered script repository. Special thanks to the sponsors of the site who provide financial support to enable the online community presence and support local PowerShell user groups – including Microsoft Windows Server 2008 R2, Quest Software, SAPIEN Technologies, Inc., Compellent, Idera, and Pragma Systems.

PowerShell.com

PowerShell.com is another community for PowerShell scripts, tips & tricks, webcasts, blogs, and other resources. Once again, Idera and Compellent are sponsoring another community resource (in addition to PowerShellCommunity.org). Concentrated Technology and nSoftware also sponsor PowerShell.com. This site also features the Master-PowerShell eBook written by Dr. Tobias Weltner. Yet another great resource for PowerShell scripters!


Get-ToThePrompt -at PowerGUI.org

PowerGUI.org

Quest Software, Inc. runs PowerGUI.org, a free community for PowerGUI users. PowerGUI is a script editor and administrative console based on PowerShell. Their community site includes tutorials, PowerPacks, forums, wikis, demos, and other goodies related to PowerGUI. If you’re using PowerGUI, then this site is a must-have resource!

#powershell on irc.freenode.net

If you’re an IRC user, definitely check out the #powershell channel on irc.freenode.net. Don’t have an IRC client? mIRC, xChat, and others are out there. Of course, freenode is awesome and has a webchat available!

Others?

These are just a few of the PowerShell resources and communities out there. Got any you want to recommend that I haven’t mentioned here? Leave me a comment!

Scripting – It’s Not Just for Developers!

Recently, Matt sent me this article on IT Pros are not feeling the love from Microsoft and asked for my feedback. Now I need to qualify this for those who don’t know me that (1) I used to work in IT doing system and database administration and desktop support and (2) I’m married to an awesome IT guy who helps keep me up on IT technology that I don’t necessarily pay close attention to.

Fears of the Cloud

In the clouds...

While there’s the cloud fear, IT pros need to understand that while we developers can write for the cloud, we don’t always necessarily understand the support and setup issues from an infrastructure point of view. So you IT pros shouldn’t feel threatened by these technologies – you need to understand that IT isn’t getting eliminated by these. But you also need to understand the cloud so that you can support your developers who are writing for it. And if the recent BPOS outages and the Amazon cloud outage are signs of anything, clouds can be unstable and you IT pros need to be able to help support your companies when their clouds fail and need to recover to something else. (And of course, there are private clouds… so don’t think you’ll get pushed out with cloud computing.)

Ch-ch-ch-changes

Ms. Shinder mentions that most people are resistant change, which is true. However, if you’re working in technology and resistant to change, then you’re in the wrong industry. Technology is constantly changing, and if you want to go forward in your career, you need to keep up with it. Falling behind leaves you to being that legacy support person. While you hang on to old technologies, they inevitably will be phased out and then you’ll be out of a job and find it hard to get into something new because you resisted change in an ever-changing field.

Code Monkey Like You?

Then there’s the case of IT pros evolving into developers. How many people really enjoy having to visit each machine in their care for updates? Wouldn’t it be easier if you could push out machine image updates automatically? Sure, you could setup a Ghost session and update a lab in downtime via multicast (ah the memories), but you could also probably script the process and not have to be there to click the “Yes” / “No” prompts that may come up. Silent installers don’t typically just work automatically – you have to run an executable at a command line with typically a /s or some other switch. If you’re familiar with working at a command prompt for tasks like that, then PowerShell isn’t as complicated or as scary as you think.

IT pros who are smart about staying ahead of the curve understand the importance of automating processes and making management easier. Be it with shell scripts in a Unix shell, VBScripts, WScripts, JScripts, batch scripts… it’s not as if scripting is new to IT work. I know some IT pros of yore who used Perl scripts to help with server management. If you were an IT pro then, I could understand complaining about scripting – while the logic (thinking about it in English) to solving a problem was simple, the syntax was pretty screwy. At least PowerShell comes a bit closer to being easier to understand – Start-Service does just what it says it does. There may be other parameters after a command, but you know what… the PowerShell help system is awesome enough to help you figure this out. You don’t have to dig through man pages or try to find online documentation. You have Get-Help Command –examples, and there are useful examples with descriptions to help you on your way.

Demystifying PowerShell

PowerShell is easy to navigate and easy to learn. It doesn’t take a lot of effort if you already have a scripting background. And if you don’t have a scripting background… as long as you can think the problem out in English, there’re guides out there who can help you through this. Matt and I have written a book that is good for just that – guiding the average IT pro with minimal to no scripting background through the craziness known as PowerShell. Give our book a chance to change that ‘PowerHell’ experience to ‘PowerFull’.