Having been a judge for the previous 2 Scripting Game competitions as well as competing in the 2 before that, I have seen my share of scripts submitted that didn’t quite meet the cut of what I felt were the best scripts. It doesn’t mean that they wouldn’t work out in the real world in a production environment (Ok, some wouldn’t :)), but some were just really hard to read or others were doing things that I wouldn’t consider to be a good practice. The first of several articles that I will be doing will start out with the use of aliases in scripts and why this is not necessarily a good idea.
Click here to be redirected to the original post of this article on the author’s blog site where you can read the remainder of the article.
In my previous blog article (PowerShell Tip #2), I left off with the subject of inline help and stated there was a better way. I’m fast-forwarding through lots of concepts and jumping right into “Advanced Functions and Scripts” with this tip because they are where you’ll find the answer to a “better way” to add inline help.
Click here to be redirected to the original post of this article on the author’s blog site where you can read the remainder of the article.
µ

If you’re looking to learn or improve on existing skills as part of a new year goal and one of those in PowerShell, then you may find it useful to check out the Winter Scripting Games 2014. When you are looking to improve your scripting skills it can sometimes be tricky if you don’t have a practical problem to solve. By taking part in these games you will have a number of opportunities to apply your skills to _real _problems.
Click here to be redirected to the original post of this article on the author’s blog site where you can read the remainder of the article.
Many thanks to SAPIEN Technologies for providing - completely without us asking - first-place and overall-best prizes for The Scripting Games!
We’ll have copies of PowerShell Studio (x2), PrimalScript (x2), and the entire SAPIEN Software Suite (x1) for our overall top-scoring team at the end of the Games. Team members can decide how to divvy up the loo themselves.
Remember that Event 1 is coming up soon:
- Instructions available 2014-01-18 00:00:00 UTC
- Entries accepted starting 2014-01-19 00:00:00 UTC
- All entries due by 2014-01-26 00:00:00 UTC
**You must be registered and on a team
before
we begin accepting entries, or you will not be able to participate. **Any latecomers will not be allowed to chat or upload files, even if they join a team.
Tip #2 - Comment (Document) your code!
This is another one of those tips that probably isn’t very popular, but regardless of how good you are at writing PowerShell scripts and functions, they’re useless if no one else can figure out how to use them. You might be thinking that you’re the only one who uses the PowerShell code that you write, but I’m sure that you like to go on vacation just like the rest of us and none of us are going to live forever.
In my tip #1 blog you learned that you need to “Read the Help!”. This tip builds on the first one because it allows others to “Read the Help!” for the PowerShell code that you write.
The type of help that you want to provide for your PowerShell functions and scripts is “Comment Based Help”. Click here to be redirected to the original post of this article on the author’s blog site where you can read the remainder of the article.
µ
PowerShell Summit North America Registration is in full swing, and we’ve got about 50 more spots to reach our break-even goal. Hopefully, those of you that have been holding off for budgetary reasons are now “weapons free” and can plan to join us in April 2014!
Confirmed PowerShell Product Team Presenters
We’ve confirmed a great set of speakers from the team itself, including Jason Shirk, Lee Holmes, Kenneth Hanson, and Hemant Manhawar. Of course, Shell Father Jeffrey Snover will also be presenting a couple of sessions!
This helps really round out our agenda, along with several special events that we’ve got planned. You’ll participate in a large-scale Iron Scripter event, mix and mingle with team members in Microsoft’s “top of the world” cafe in downtown Bellevue, and rub elbows with PowerShell experts from all over the world during our pre-event mixer.
When you’re logged into the Games, you’ll notice that clicking on your team pulls up a “team discussion” box. That’s a shared discussion area for you and your team.

However, if you click on one of the files you’ve uploaded, you’ll see the discussion turn into a “File Discussion.” We retain a separate thread for each file you upload, so that you and your team can discuss that file specifically.

Note that as of the time of this post (about 2pm Pacific on Jan 5th), the following teams do not have enough players to participate in the upcoming Practice Event:
- Lake County Hoosiers
- A
- Annihilators
- AZPOSH
- Avengers
- PeopleTecIsAwesome
- Time Travel is Dangerous
- Kotagiris
- wow. much power. very shell.
- Blasters
- CCC
- Anteaters
- Barracudas
- Hypothermia
- Bearcats
- #PSexec
- Avalanche
- Bull Gators
- Alligators
To reiterate: **You must have 2-6 players signed into the Web site and joined to your team, or you will be unable to post entries. **Anyone joining after midnight UTC on Jan 6th will not count toward your team total for the Practice Event.
Many of the above teams are “private,” which means nobody can join them without the team invite code.
If you are on one of the following teams, especially if it’s public, _consider quitting NOW and joining another public team that needs players. _Otherwise, you may miss out on the practice event, which starts in just a couple of hours.
DSC Setup and Demo Scripts
I recently set up a virtual machine to use for Desired State Configuration (DSC) demos. I wanted to make the demo-ing fairly brainless, as DSC requires a number of setup steps to get a pull server running. So I took some demo scripts Microsoft offered from TechEd 2013, updated them to work with Windows Server 2012 R2 RTM, and thought I’d offer them to you.
SetupDSC.ps1 is the main script. Now, because I didn’t want to use good ol’ Start-Demo, there’s a who crapload of kinda ugly Write-Debug statements. That way I can get an “about to do ____” message and then have the script pause before doing it. Lets me explain to the class what’s about to happen. You can remove all that crud if you like.
InstallPullServerConfig.ps1 and PSWSIISEndpoint.psm1 are the updated Microsoft scripts. SetupDSC.ps1 calls these. They’re intended to run locally; you’ll need to be _on _the machine you want to make into a pull server, and it needs to be Windows Server 2012 R2 (the DSC pull server role is part of the OS, not part of Windows Management Framework v4). Setup takes a few minutes, and will install IIS. This sets up an HTTP pull server.
SampleConfig.ps1 is a sample DSC configuration, targeted to a computer named MEMBER2. It just specifies that the Windows Server Backup feature be installed. SetupDSC.ps1 actually runs this, which produces a MOF. SetupDSC.ps1 also copies the MOF to the DSC pull server configuration directory.
SampleSetPullMode.ps1 also gets run by SetupDSC.ps1. This contains a DSC Local Configuration Manager configuration, targeted to MEMBER2, that turns on pull mode and directs MEMBER2 to pull the previously-created configuration. I think I have it refreshing every 5 minutes, which is totally unrealistic for production. Again, this was made for class demos, but you can adjust the time or leave it off to default to 30min. Running this script creates the MOF and pushes it to MEMBER2. That, in turn, causes MEMBER2 to start pulling the sample config, which causes Windows Server Backup to be installed.
SetupDSC.ps1 has some additional code to show that Windows Server Backup isn’t installed, and then is installed (after you give the pull time to occur).
Anyway, might need some tweaking to use in production, but hopefully it’ll give you a snapshot of the whole DSC process. Much thanks to James Dawson’s article on DSC, which gave me a couple of the tweaks I needed to get all this working on RTM code.
Enjoy.