The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,360 other followers

Archive for the ‘PowerShell’ Category

Let’s stop copying C / fuzzy notepad

Posted by jpluimers on 2017/12/07

Ah, C. The best lingua franca we have… because we have no other lingua francas. Linguae franca. Surgeons general? C is fairly old — 44 years, now! — and comes from a time when there were possibly more architectures than programming languages. It works well for what it is, and what it is is a relatively simple layer of indirection atop assembly. Alas, the popularity of C has led to a number of programming languages’ taking significant cues from its design, and parts of its design are… slightly questionable. I’ve gone through some common features that probably should’ve stayed in C and my justification for saying so. The features are listed in rough order from (I hope) least to most controversial. The idea is that C fans will give up when I call it “weakly typed” and not even get to the part where I rag on braces. Wait, crap, I gave it away.

Great re-read towards the end of the year: [WayBackLet’s stop copying C / fuzzy notepad

Via: [WayBack] Old and busted: emacs vs vi. New and hot: Language war, everybody against everybody else. – Kristian Köhntopp – Google+


Posted in .NET, APL, Awk, bash, BASIC, C, C#, C++, COBOL, CoffeeScript, CommandLine, D, Delphi, Development, F#, Fortran, Go (golang), Java, Java Platform, JavaScript/ECMAScript, Pascal, Perl, PHP, PowerShell, PowerShell, Python, Ruby, Scala, Scripting, Software Development, TypeScript, VB.NET, VBScript | 3 Comments »

how to filter name/value pairs under a registry key by name and value in PowerShell – Stack Overflow

Posted by jpluimers on 2017/09/06

A long time ago I asked this question how to filter name/value pairs under a registry key by name and value in PowerShell? – Stack Overflow [WayBack] but forgot to schedule a post about it.

It’s an interesting scenario, so lets start with a log of the outcome (it’s on my ix500 scanning VM which has Office15 a.k.a. Office 2013 installed) of this script:

$path = 'hkcu:\Software\Microsoft\Windows\CurrentVersion\Extensions'
$key = Get-Item $path

$namevalues = $key | Select-Object -ExpandProperty Property | 
  ForEach-Object { 
    [PSCustomObject] @{ 
      Name = $_; 
      Value = $key.GetValue($_) 
$namevalues | Format-Table

$matches = $namevalues | 
  Where-Object { 
    $_.Name -match '^xls' `
    -or $_.Value -match 'msaccess.exe$' 
$matches | Format-Table

It outputs this:

Read the rest of this entry »

Posted in Development, PowerShell, Registry Files, Scripting, Software Development | Leave a Comment »

How bad is the Windows command line really?

Posted by jpluimers on 2017/04/13

How bad is the Windows command line really?

The Windows command line is bad. Very bad.

But it took until recently for old Windows versions – that out of the box had either no or poor PowerShell versions – to have slowly died.

So only now PowerShell finally has become an option that really works across all Windows versions I use. Go PowerShell!


Posted in Batch-Files, Development, PowerShell, Scripting, Software Development | Leave a Comment »

PowerShell: when Format-Table -AutoSize displays only 10 columns and uses the width of the console when redirecting to file

Posted by jpluimers on 2017/03/09

Lets start with the second problem: There are various ways to redirect PowerShell output to a file.

  • Shell redirect with a greater than sign (>) to create/overwrite output or two greater than signs (>>) to append output.
  • Use Out-File [WayBack] with a filename and either -FilePath (default, similar to >) or -Append (similar >>).

I write “similar” as they are not fully equivalent. That’s where Format-Table [WayBack] with the -AutoSize parameter comes in (with or without a -Wrap parameter).

Apart from Format-Table displaying only 10 columns by default (see below), the -AutoSize will change columns presentation depending not just on the -Wrap parameter but also to the total width it thinks it has available.

Useful Format-Table parameters

First the representation:

Read the rest of this entry »

Posted in CommandLine, Development, Power User, PowerShell, PowerShell, Scripting, Software Development, Windows | Leave a Comment »

Regularly forcing Microsoft Silverlight to be a hidden Windows Update

Posted by jpluimers on 2017/01/03

I got a bit fed-up with the deprecated Microsoft Silverlight reappearing as KB3056819 in each Windows Update within minutes of hiding it (I’m not alone on this, it does this when you have configured to favour the Microsoft Update Servers – that also update Office – in favour of the Windows Update Servers).

Two really odd things:

  1. In the past, I hid “Skype for Windows desktop 7.3 (KB2876229)” which stayed hidden.
  2. I never installed Silverlight, there is no Silverlight on the system (I checked the registry, file system with Everything and more), but the update keeps re-appearing (like KB960353 does for others).

So I wanted a script that every minute could check for a Microsoft Silverlight update, then hide it.

That appeared a lot more cumbersome than I anticipated, hence this blog post.

The reason is that unlike many other operating systems, Windows does not come with a build-in package manager that you can script (there is Windows Installer, but is’s not easily scriptable).

Read the rest of this entry »

Posted in Development, PowerShell, Scripting, Software Development | Leave a Comment »

%d bloggers like this: