A PowerShell WPF DSL (Part 2) – Getting Control Values

Some Background Before I start, I should probably take a minute to explain what a DSL is and why you would want to use one. A DSL (domain-specific language) is a (usually small) language where the vocabulary comes from a specific problem domain (or subject).  Note that this has nothing to do with Active Directory …

Continue reading ‘A PowerShell WPF DSL (Part 2) – Getting Control Values’ »

Starting a PowerShell DSL for WPF Apps

The problems There is always a problem. In my case, I had two problems. First, when I teach PowerShell, I mention that it’s a nice language for writing DSLs (domain-specific languages). If you want an in-depth look, Kevin Marquette has a great series on writing DSLs. I highly recommend reading it (and everything else he’s …

Continue reading ‘Starting a PowerShell DSL for WPF Apps’ »

Celebrating 1 Year of Southwest Missouri PowerShell User Group (SWMOPSUG)

So…we’ve been meeting in Springfield, MO for a year now. Our first meeting was in June 2017 and had our “anniversary” meeting earlier this month.  Thanks to Scott for presenting a talk about PowerShell jobs! We haven’t had big crowds, but we have had good consistent attendance.  Looking forward to another year and reaching out …

Continue reading ‘Celebrating 1 Year of Southwest Missouri PowerShell User Group (SWMOPSUG)’ »

A Modest Proposal about PowerShell Strings

If you’ve used the PowerShell Script Analyzer before you are probably aware that you shouldn’t be using double-quoted strings if there aren’t any escape characters, variables, or subexpressions in them.  The analyzer will flag unnecessary double-quotes as problems.  That is because double-quoted strings are essentially expressions that PowerShell needs to evaluate. Let me repeat that… Double-quoted …

Continue reading ‘A Modest Proposal about PowerShell Strings’ »

Get-Learning – Launching Powershell

I thought I’d take a few minutes and show several ways to launch PowerShell. I’ll start with the basics and maybe by the end there will be something you haven’t seen

before.

The Start Menu

One of the first places to look for PowerShell is in the Start Menu. Opening the start menu and typing “PowerShell” will get you something like this:


Note that there are several options

  • Windows PowerShell (64-bit console)
  • Windows PowerShell ISE (64-bit ISE)
  • PowerShell-6.0.0 (PowerShell Core…you might not have this)
  • Windows PowerShell (x86)  (32-bit console)
  • Windows PowerShell ISE (x86) (32-bit ISE)

There’s also a “debuggable package manager”, which is a Visual Studio 2017 tool (and essentially the 32-bit console).

For each of these, you can click on it to launch, but there are other options as well:

  • Click to run a standard PowerShell session
  • Right-Click and choose “Run As Administrator” to run an elevated session (if you are a local administrator)

You’ll also notice that the right-click menu has options to run the other versions (ISE/Console, 32/64-bit).

The Run dialog

From the Run dialog (Windows-R), you can type PowerShell or PowerShell_ISE to launch the 64-bit versions of these tools.

What you may not know (and I just learned this recently, thanks Scott) is that if you hit ctrl-shift-enter, instead of just hitting enter, it will run them elevated (as administrator).

Windows Explorer

The final place I’m going to mention is Windows Explorer.  If you have it open, you can launch PowerShell or the ISE in the current directory by typing PowerShell or PowerShell_ISE in the address bar like this:


Can you think of other ways to launch PowerShell (other than from PowerShell…that would be cheating)?  Let me know in the comments.

 

–Mike

Old School PowerShell Expressions vs New

In a recent StackOverflow answer, I wrote the following PowerShell to find parameters that were in a given parameter set (edited somewhat for purposes of this post): A quick note…it’s not correct. It only shows parameters that are explicitly in the parameter set. Items that aren’t marked with any parameter set are in all parameter …

Continue reading ‘Old School PowerShell Expressions vs New’ »

Getting Data From the Middle of a PowerShell Pipeline

Pipeline Output   If you’ve used PowerShell for very long, you know how to get values of of a pipeline. Nothing too difficult there. Where things get interesting is if you want to get data from the middle of the pipeline. In this post I’ll give you some options (some better than others) and we’ll …

Continue reading ‘Getting Data From the Middle of a PowerShell Pipeline’ »