Skip to main content

Posts

Showing posts with the label PowerShell

Registering an Azure Resource Provider with PowerShell

Azure seems to be the cloud that just keeps building and building. Resource providers allow Azure to provide services.  For example, virtual machines utilize the Microsoft.Compute  resource provider to provide services to Azure so you can have a virtual machine.  Checkout this article to see what the Microsoft.Compute exposes to Azure:  https://docs.microsoft.com/en-us/azure/role-based-access-control/resource-provider-operations#microsoftcompute It is not that exciting to look at.  What is exciting is what resource providers can do.  Azure acts as an orchestrator.  The resource providers tell Azure what they can do and they perform all the work.  Each resource must be registered with the subscription before Azure can utilize them.  Just remember that you cannot unregister a resource provider if any Azure asset in your subscription is using it. (Note: The following assumes that you are using VSCode and are logged into your Azure subscr...

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...

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 us...

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...

What Will a Cmdlet Accept Through the PowerShell Pipeline?

Happy New Year! Ok, that is a bit late.  I'm getting around to catching up on some questions from my classes last year.  Here is a good one. What Will a Cmdlet Accept Through the PowerShell Pipeline? Well, that is a good question.   How a object is piped from one cmdlet to another is a touchy subject in my PowerShell classes.   This extremely powerful feature needs to be used, but the research that goes into it for new PowerShell developers can be a bit complex.   To help out, I built a cmdlet to read the help files of a cmdlet or script and determine what parameters accept pipeline input ByValue or ByPropertyName and what data type they require.   All of these are required to help the developer understand if they can pipe their objects to a cmdlet. Here you go!  Have fun with it. Function Get-PipelineInfo { [ CmdletBinding () ] Param (     [ String ]     $Cmdlet ) Write-Verbose "Pip...