Skip to main content

Posts

Showing posts from 2019

My Advanced PowerShell Class has just been updated!

First of all, thank you to my fellow presenters at PowerShell Conference Asia 2019.  All of you really helped me to update the content of my advanced PowerShell class.  Content will be delivered in PowerShell 7.  We will be addressing compatibility with your pre-exiting scripts when running in PSv7 as well as providing a few new tricks. As you can see, I am also adding in content on some of the experimental features that I think are going to be a hit.  If you are interested, drop me an email and I'll help get you into a physical class or join me on an online class.

My VSCode Configuration for PowerShell

Two weeks ago, I had the honor of delivering a workshop at PowerShell Conference Asia in Bangalore.   My workshop was called Zero to Hero where I taught the fundamentals of PowerShell with the goal of allowing the conference attendees to have the confidence to attend the rest of the high-level sessions.   It was a success!   With 60 PowerShell enthusiasts enrolled, the organizers had to close registration. I made the decision to utilize VSCode as our scripting platform to get the attendees on the path from the ISE to VSCode.   One of the first questions given to the PowerShell team members at the conference was “Will there be an ISE for PowerShell 7”.   Their answer, “No”.   I also made the decision to deliver the class using the just released PowerShell 7-Preview 4.   This version addressed several issues that I had with Preview 1-3.   It is not perfect, but it is now at the performance and reliability level that I want and I am teaching it in my Windows PowerShell c

The Return of Out-GridView

Yes, our beloved cmdlet Out-GridView has been returned to us!   The original Out-Gridview was an easy and convenient way to quickly create GUI output and to accept limited input. In PowerShell Core (PSv6) we lost our beloved cmdlet.   Well, it is back! For these demonstrations I am utilizing PowerShell 7-Preview 4. Out-Gridview is actually being provided as a module.  Execute the code below to install it.  Out-GridView still works the same as it did before. Let’s take a look at a few of the features and what is new with Out-GridView.  The Quick Serach field works the same at the Filter field in the Windows PowerShell version of Out-Gridview.  Type something and if what you type appears in any of the objects property. Here is something new.  It involves the filtering capability.  Once you build a filter, click the Show Code button. You can now have Out-GridView to create the filter it is using in code so you can copy it and past

How to Create and Use a Multi-Dimensional Array with PowerShell

An array is a neat little data structure that allows you to store more than one piece of information in a single variable.   Take a look at the examples below. $VariableName 10 In this example, we have a standard variable.   It contains only one value. PS C:\> $VariableName 10 An array is a bit different.   It stores each value in a unique index number. $Array1 0 Apple 1 Pear 2 Plum PS C:\> $array1 Apple Pear Plum PS C:\> $array1[1] Pear A multidimensional array is like a grid (2 dimensional) or a cube (3 dimensional).   You can add more dimensions but those beyond 3 are hard to conceptualize.   $Array2 0 1 2 0 Dog Alpha 100 1 Cat Bravo 200 2 Bird Charlie 300 Take a

Active Directory Web Services Configurations

Yes, I am actually taking the time to add some blog posts! In class today we had a question about setting the  MaxGroupOrMemberEntries to Unlimited  in the Active Directory Web Servers configuration file.  Unfortunately, I could not find a way.  Just set this value to be very high.  Just remember, your results must come within 5 minutes or you will hit the time out.   I also forgot how hard it was to find these settings.  Here is a link to the Microsoft article that contains the configuration properties and how to use them:   https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2008-R2-and-2008/dd391908(v=ws.10) Happy coding everybody!

Where to Create a Constant in an Advanced Function?

This week I am delivering a PowerShell Toolmaking class in Phoenix.   Right now we are studying advanced functions.   While talking about the BEGIN, PROCESS, and END block, one of my future PowerShell Rock Stars gave me a great idea.   Where should a constant be created in an advanced function> A constant is, by definition, something that cannot be changed after it is created.   So, here is how you create one. $ CONST = New-Variable -Name Constant1 -Value 10 -Option Constant You cannot modify this constant with Set-Variable -Force and you cannot remove this constant with Remove-Variable -Force.   That is the idea.   You need to close your current scope of memory to get rid of it. The BEGIN, PROCESS, and END blocks of an advanced function have unique capabilities. The BEGIN block is executed when your cmdlet receives the first object in the pipeline, but before the PROCESS block is executed.   It is only ran once to allow you the opportunity to do any set up