Skip to main content

Posts

Showing posts from December, 2016

Using Here-Strings to help search United Airlines for Flight Dates

As many of you know, I am fortunate to teach Windows PowerShell, Server, and Client all over the world.  One thing that I do not do very often is use my air miles.  This is has been a very deliberate action because I wanted to make sure that when my wife decides to fly to Europe with me, she will do so in style.  Well, the time has come.  I’m heading over to Europe to speak at the PowerShell Conference in a few months and my wife and I are going to spend some time together hunting down what we hope will be distant relatives and doing a little sightseeing.  So, I’m burning the air miles to fly family to my home to house sit and for us to fly over the pond in United Polaris Class.  My wife does not like long flights so I am determine to spend the air miles wisely to make sure she is as comfortable as possible.  I’ve made the flight many times in coach, but I would be a bad husband if I did not splurge a bit on my wife. Below is the difference. Business/Polaris What I usua

Exchange Online Error: You must provide a required property: Parameter name: UsageLocation

I’m continuing my efforts to update MOC 20697-2 this morning.  I’ve decided to add additional information on Office365.  Microsoft removed over 2000 SaaS products from Azure in October of 2016.  This resulted in 2 lessons of this class now being void.  While adding in content for Exchange Online, I discovered an error. Set-MsolUserLicense : You must provide a required property: Parameter name: UsageLocation At line:1 char:1 + Set-MsolUserLicense -UserPrincipalName "KFrog@Adatum2008JY.onmicrosof ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~     + CategoryInfo          : OperationStopped: (:) [Set-MsolUserLicense], MicrosoftOnlineException     + FullyQualifiedErrorId : Microsoft.Online.Administration.Automation.RequiredPropertyNotSetException,Microsoft.Online.Administration.Automation.SetUserLicense This error played with me for a while.  It is telling me that I am missing a property and its’ parameter name is UsageLocation.  I went t

Removing and Unwanted PowerShell Module

This evening I’m enjoying my warm hotel room. I’m in Saskatoon, Canada in winter teaching PowerShell so no sight seeing this trip. On the plus side, I’m prepping to teach MOC 20697-2B next week from the comfort of my office in Phoneix.  Naturally, I’m looking over my PowerShell code for the class and making sure there have not been any surprise changes with Azure or my cmdlets from the PSGallery. I’ve noticed that the module for OneDrive has a version change.  The problem  is, I already installed the new one. PS C:\> Get-Module -Name OneDrive -ListAvailable     Directory: C:\Program Files\WindowsPowerShell\Modules ModuleType Version    Name          ExportedCommands                                                   - --------- -------    ----          ----------------                                                                Script     1.0.3      OneDrive      {Get-ODAuthentication, Get-ODWebContent, Get-ODDrives...  Script     0.9.2      OneDrive    

Auto Populating a Parameters’ Value from a Dynamic List

First off, I want to give a shout out to Author: Martin Schvartzman and his blog posting https://blogs.technet.microsoft.com/pstips/2014/06/09/dynamic-validateset-in-a-dynamic-parameter/ . A question that I often get when teaching parameter validation is "can you load the values of a parameter dynamically?" Up until now, my answer was no.  Time to change that.  After getting that question again, I did some more research and found Martin’s article.  Simply adjusting 1 line of the code from his blog posting allowed me to load the SamAccountNames of all users in the domain as the valid, and TAB complete capable, values of a parameter.  Below is that code: # Author: Martin Schvartzman # https://blogs.technet.microsoft.com/pstips/2014/06/09/dynamic-validateset-in-a-dynamic-parameter/ # Minor modifications: Jason Yoder function Test-DynamicValidateSet {     [ CmdletBinding ()]     Param (         # Any other parameters can go here     )     DynamicPar

Dealing with Property Names that Start with #

Tonight I’m doing my class maintenance on Microsoft Official Course 20697-2B Deploying and Managing Windows 10 Using Enterprise Services . For those of you who have taken my classes, you know I provide a OneDrive full of goodies to each class.  Right now I’m playing around with Chapter 3 and the migration of user data.  While working with size estimates for the migration store, I decided to import the XML file the ScanState.exe /p produces. PS USMT:> $StorageInfo.Premigration.storeSize.Size | Get-Member –MemberType Properties    TypeName: System.Xml.XmlElement Name        MemberType Definition ----        ---------- ---------- #text       Property   string #text {get;set;} clusterSize Property   string clusterSize {get;set;} So, do you see the problem?  Take a look at the property called #text .  In PowerShell, the # symbol is the start of an inline comment.  That means that anything typed after it will not be processed.  That kind of makes calling this prope

Using Events with SAPIEN PowerShell Studio

This is the last posting that I am doing on these series focusing on objects.  So far we have describe how properties describe an object.  We looked at how methods take actions against an object.  We also looked at how to subscribe to an objects events.  An event is triggered when something happens to an object. Today we are going to create a very basic graphic interface using SAPIEN PowerShell Studio and demonstrate how to register and event and execute code when the event is triggered. You can get a trial version from here (https://www.sapien.com/software/powershell_studio) .  Just click on the Try It link on the right.  This trial version is limit to just 5 graphical objects.  We will only be using one for simplicity.  Install and then launch the software. Once you open SAPIEN PowerShell Studio, click File à New à New Form . In the popup window, select Empty Form and then click Select . From the Toolbox, drag and drop the Button object onto your form.