zigford.org/first-look-at-powershell-610.html
2020-07-21 06:49:32 +10:00

159 lines
5.3 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="main.css" type="text/css" />
<link rel="stylesheet" href="blog.css" type="text/css" />
<link rel="alternate" type="application/rss+xml" title="Subscribe to this page..." href="feed.rss" />
<title>First look at powershell 6.1.0</title>
</head><body>
<div id="divbodyholder">
<div class="headerholder"><div class="header">
<div id="title">
<h1 class="nomargin"><a class="ablack" href="http://zigford.org/index.html">zigford.org</a></h1>
<div id="description"><a href="about.html">About</a><a href="links.html"> | Links</a><a href="scripts.html"> | Scripts</a><br>Sharing linux/windows scripts and tips</br></div>
</div></div></div>
<div id="divbody"><div class="content">
<!-- entry begin -->
<h3><a class="ablack" href="first-look-at-powershell-610.html">
First look at powershell 6.1.0
</a></h3>
<!-- bashblog_timestamp: #201809150832.39# -->
<div class="subtitle">September 15, 2018 &mdash;
Jesse Harris
</div>
<!-- text begin -->
<p>Powershell <a href="https://github.com/PowerShell/PowerShell/releases">6.1.0</a> dropped yesterday. Here is my quick look.</p>
<h2>New Commands</h2>
<p><code>Get-Command | Measure-Object</code> on each version:</p>
<p>Version 6.0.4 had 316 commands, while 6.1.0 has 323 commands. Comparing a list
of commands:</p>
<p>On 6.0.4: <code>gcm | select -exp name &gt; 6.0.4.txt</code> and the same on 6.1.0, then to
compare:</p>
<pre><code> compare-object (gc ./6.0.4.txt) (gc ./6.1.0.txt)
InputObject SideIndicator
----------- -------------
ConvertFrom-Markdown =&gt;
Get-ExperimentalFeature =&gt;
Get-MarkdownOption =&gt;
Set-MarkdownOption =&gt;
Show-Markdown =&gt;
Start-ThreadJob =&gt;
Test-Connection =&gt;
Test-Json =&gt;
more &lt;=
</code></pre>
<hr />
<p>Firstly, yay for <code>Test-Connection</code>. I had to reimplement that one by parsing
results from <code>ping</code> previously to make some of my windows modules work on PS
core. Start-ThreadJob looks interesting and I can't wait to see what the
Markdown cmdlets do.</p>
<p>I'll look more at these new commands later, but while I was running
Get-Command, I thought I'd see if there were any generic performance
improvements in 6.1.0 release.</p>
<p>On 6.0.4:</p>
<pre><code> PS /home/harrisj&gt; measure-command {gcm | select -exp name}
Days : 0
Hours : 0
Minutes : 0
Seconds : 0
Milliseconds : 718
Ticks : 7185832
TotalDays : 8.31693518518518E-06
TotalHours : 0.000199606444444444
TotalMinutes : 0.0119763866666667
TotalSeconds : 0.7185832
TotalMilliseconds : 718.5832
</code></pre>
<p>On 6.1.0:</p>
<pre><code> PS /home/harrisj&gt; measure-command {get-command | select -exp name }
Days : 0
Hours : 0
Minutes : 0
Seconds : 0
Milliseconds : 455
Ticks : 4558407
TotalDays : 5.27593402777778E-06
TotalHours : 0.000126622416666667
TotalMinutes : 0.007597345
TotalSeconds : 0.4558407
TotalMilliseconds : 455.8407
</code></pre>
<p>A modest speed boost. Definitely appreciated on the old RPI 2 that hosts this
site.</p>
<h3>Kicking the tires on new command</h3>
<h2>Show-Markdown</h2>
<p>I gave this a quick try and it colour highlighted and shows a preview of the
markdown in the terminal window. It also had a -UseBrowser parameter which
writes a tmp html and open's it in the browser. Pretty neat.</p>
<h2>ConvertFrom-Markdown</h2>
<p>What you'd expect, this converts a Markdown file to html to stdout or to a
file if specified. Who knows, I might see if I can get this site to work using
this implementation of Markdown. Currently I'm using the Markdown.pl from
Gruber.</p>
<h2>Get-ExperimentalFeature</h2>
<p>Does nothing on the RPI and MacOS. Will have to spin this up on Windows and
update this article</p>
<h2>Test-Json</h2>
<p>Just ran this over a json file I use in one of my projects:</p>
<pre><code>Test-Json -Json (gc ./Template.json -raw)
True
</code></pre>
<h2>Start-ThreadJob</h2>
<p>This might take a bit more time to find the true value of it, but I quickly
tried my simultaneous ping test with this and it spawned a number of PSJobs
with a PSJobTypeName of ThreadJob.</p>
<h3>Closing thouhghts</h3>
<p>Thats it for now. I've heard this release focused alot on bringing Windows
cmdlets back for Windows, so not-so-much in this one for the *nixes. Still
an improvement either way</p>
<p>Tags: <a href='tag_powershell.html'>powershell</a></p>
<!-- text end -->
<!-- entry end -->
</div>
<div id="footer">&copy <a href="http://twitter.com/zigford_org">Jesse Harris</a> &mdash; <a href="mailto:jesse&#64;zigford&#46;org">jesse&#64;zigford&#46;org</a><br/>
Generated with <a href="https://github.com/cfenollosa/bashblog">bashblog</a>, a single bash script to easily create blogs like this one</div>
</div></div>
</body></html>