Wiki Life: PowerShell PowerPack!


Today's post is a quick one, but it's something close to my heart! 

I'm constantly writing Wiki articles and blog posts about PowerShell. PowerShell is awesome, and so many tasks can be simplified using it. Sharing examples is something I like to do, and I always turn to one tool to format my code examples… The PowerShell PowerPack!

The PowerShell PowerPack is documented on the Technet Wiki here, Wiki: How to Insert Formatted Windows PowerShell Code on TechNet Wiki

It's a module that, once imported into PowerShell, allows you to copy and paste colorised PowerShell code as HTML. Great for pasting code examples into Wiki articles!!

Here's an example from one of my articles, SharePoint 2013: Get Set and Copy User Profile Properties using PowerShell

[void][reflection.assembly]::Loadwithpartialname("Microsoft.Office.Server");                        
$site=new-object Microsoft.SharePoint.SPSite("https://c05470sp10:7443");                        
$serviceContext = Get-SPServiceContext $site;                        
$site.Dispose();                        
$upm = new-object Microsoft.Office.Server.UserProfiles.UserProfileManager($serviceContext);                        
$userProfile = $upm.GetUserProfile("myarlett@company.com");

Awesome huh!?

Comments (6)

  1. Formatted code is easier to read. The colorization also helps, and makes it look more professional.

  2. Saeid Hasani says:

    Awesome!
    Thanks Matthew for sharing! 🙂

  3. pituach says:

    Thanks Matthew
    * I agree with Richard "Formatted code is easier to read" and it give to all the articles same basic format, which is good. We don’t want that each page in the WIKI will look like, part of a different website 🙂

  4. This is a fantastic contribution to the community!

    The first link in the article seems to be broken:
    http://code.msdn.microsoft.com/PowerShellPack/Release/ProjectReleases.aspx?ReleaseId=3341

    Thoughts?

Skip to main content