Saturday, August 24, 2019

I saw Rick Bielawski speak on PowerShell at PASSMN on Tuesday night.

There is no multithreading in PowerShell. The PowerShell ISE (Integrated Scripting Environment) is kinda like an IDE (Integrated Development Environment) for PowerShell. There is a pane at the right that has tabs to various .ps1 files. You may run the whole of a file with F5 or you may highlight just a piece of the file, perhaps a line, and then click F8 to run just that bit of the file. Chasing a variable containing tabular data with Out-GridView will barf up a separate window with a tabular recordset format that is easily portable to Excel and column-filterable by way of some dropdowns. There is no command called help so help sql will just find all of the "everything" that has sql in it. Get-Help Get-Verb –ShowWindow will open a little help file on Get-Verb which gives you a list of approved verbs in PowerShell and obviously you may swap out Get-Verb with something else. Per Rick the thing that gives PowerShell all of its power is that everything is an object and you may dot off the object in the right pane of PowerShell ISE (heard a coworker pronounce it: "PowerShell Ice") and get IntelliSense as to what "hangs off" the object. ([string]1).GetType() is an example of casting to a string (use int for integers) and "string"|gm is an example of handing a string with "string" inside of it to the Get-Member cmdlet which reveals the properties and methods of an object. "simple".Length gives us 6 because that is how long "simple" is. dir *.ps1 lists all of the files that end in .ps1 while dir *.ps1|gm gives their details in tabular format and dir *.ps1|gm|fl in a sequential list dump wherein each list item had a lot of details. The cmdlet on the end here is Format-List in its shorthand form. dir variable:\ gives you all variables in scope. cd SQLSERVER:\SQL\WN-MNA1HXA1C585\ an example of "changing directories" into SQL Server and following that up with dir DEFAULT\DATABASES\Rick\tables navigates into the tables for a particular database wherein dir will just give a list of tables. To hand something in on the right side of the gm instead of using the pipe symbol you have to do something like gm -InputObject $env:Path.Split(';') or gm -i $env:Path.Split(';') more tersely. $env:Path.Split(';').count will give you the number of line items returned by the previous two commands. function t{} followed by t gives nothing and function t{$x = $env:COMPUTERNAME} followed by t and then by $x also does nothing because of the scoping of $x but function t{$env:COMPUTERNAME} followed by t will tell you the name of your computer. 1,2,3|ForEach-Object {t $_} hands in each of the leading numbers to t. A shortcut for ForEach-Object looks like so:
1,2,3|%{
   t $_
   'hi'
}

This is equivalent to 1,2,3|%{ t $_ ; 'hi' } as if you don't want to use a line break you may use a semicolon. In Install-Module SqlServer –AllowClobber the –AllowClobber overpowers a conflict. The event was once again held at Microsoft's offices in Edina and I took this second picture of Rick Bielawski as we were waiting to leave on the elevator out together. The first picture I took of him actually presenting is kind of weak as it is backlit by too much sun coming in a window. Other things mentioned at this event included the new version 2 of Microsoft HoloLens and Hyperion which is a company that Oracle bought which offers products/software in the BI (business intelligence) sphere of things. Joshuha Owen gave a lighting talk on a PowerApp he made with PowerApps at the very end of the evening. His creation used Flow (which allows one service to talk to another service and which is very drag-and-drop and trigger-driven like PowerApps) to talk to Custom Vision (from PowerApps), a ReST API for AI (artificial intelligence) for image recognition. AI Builder in the PowerApps space itself is an alternative to Custom Vision. Logic Apps is an alternative to Flow but it is more geared to the enterprise level of things. You have to feed Custom Vision at least twenty five images to get it to start recognizing a pattern, but the more you feed it the better.

No comments:

Post a Comment