The Wiert Corner – irregular stream of stuff

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

  • My work

  • My badges

  • Twitter Updates

  • My Flickr Stream




    More Photos
  • Pages

  • All categories

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

    Join 1,722 other followers

Archive for the ‘PowerShell’ Category

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 »

Windows 10 – language neutral batch file to start Windows

Posted by jpluimers on 2017/02/22

A while ago, I bitched that Microsoft moved away the Windows Update out of the Control panel into a language depended place (in Windows 10 1511 update broke the Hyper-V networking – Fix network connection issues).

Since then I had to maintain too many locales running Windows 10. So here is the batch file:

for /f "delims=" %%A in ('PowerShell -Command "(Get-Culture).Name"') do explorer "%LocalAppData%\Packages\windows.immersivecontrolpanel_cw5n1h2txyewy\LocalState\Indexed\Settings\%%A\AAA_SystemSettings_MusUpdate_UpdateActionButton.settingcontent-ms"

It uses these tricks:

  1. Set output of a command as a variable (in this case a for loop variable)
  2. Execute PowerShell script in a .bat file
  3. PowerShell Get-Culture (which gets a .NET CultureInfo instance)
  4. CultureInfo.Name property (which has the nl-NL, en-US, etc codes in it)

It replaced this simple batch-file which has worked for like 10 years:

%windir%\System32\rundll32.exe url.dll,FileProtocolHandler wuapp.exe


via: Windows Update Shortcut – Create in Windows 10 – Windows 10 Forums

Posted in .NET, .NET 1.x, .NET 2.0, .NET 3.0, .NET 3.5, .NET 4.0, .NET 4.5, Batch-Files, CommandLine, Development, Power User, PowerShell, Scripting, Software Development, Windows, Windows 10 | Leave a Comment »

Powershell 4.0 hates Lucida Console and switches to raster fonts

Posted by jpluimers on 2016/07/25

PowerShell 4.0 is madly in love with

PowerShell 4.0 is madly in love with “English (United States)”

A long time ago I started writing up my blog post like this in March 2015 when I bumped into this the first time when upgrading from PowerShell 2 to PowerShell 4:

It seems there is no real workaround:

Good and not so good news: after reading the below linked posts, this is what works:

  • PowerShell 4 and up works fine with any Lucida Console size (including 12) and boldness
    • only when the “Language for non-Unicode programs” is set to “English (United States)”.
  • PowerShell 4 works fine with Consolas on any size and boldness
    • for any “Language for non-Unicode programs”

So if you’re like me and switch between “Dutch (Netherlands)” and “English (Ireland)” a lot (both use the EURO as currency, but have distinct enough other locale settings to cover a lot of European stuff) then you need to get used to the Consolas font.



Posted in CommandLine, Development, Power User, PowerShell, PowerShell, Scripting, Software Development, Windows, Windows 10, Windows 7, Windows 8, Windows 8.1, Windows 9 | Leave a Comment »

Get the full exe path name of running processes.

Posted by jpluimers on 2016/02/03

Every once in a while, I need to see which EXE paths.

In this particular case, I wanted to see which Spring.Tests unit tests instances of Sprnig4D werere running.

This case I needed to see which DevEnv were running (because somehow I got my .csproj bindings wrong).

Since tasklist nor pslist would cut it, I wrote two small batch files:


PowerShell to the rescue here: Both use the PowerShell Get-Process cmdlet.

First I used Get-Member to see what Get-Process could return:

PowerShell Get-Process ^| Get-Member

Then I filtered the Path from Get-Process to figure out which Spring.Tests processes were running:

PowerShell Get-Process Spring.Tests ^| Format-List Path

resulting in:

Path : C:\Users\Developer\Versioned\Spring4D\Tests\Bin\DelphiXE\Spring.Tests.exe

The second batch file escapes the pipe (|) by using a carret (^), so it is passed from the command-line to PowerShell.


Posted in CommandLine, Development, PowerShell, Software Development | 2 Comments »

Dynamic DNS through NO-IP: keeping your hosts current, and your NO-IP account happy.

Posted by jpluimers on 2015/05/19

Now that DynamicDNS moved itself to a fully payed service, named it DynDns Pro, then renamed it Remote Access and limiting it to 30 hosts for USD 25 a year, I looked for alternatives, and noticed NO-IP.

I like it for a few reasons:

OK, last year, there was this Microsoft Legal Action and Controversy, but I think that is a once time thing (some people even argue that Microsoft wasn’t thinking), so I created the last script below in PowerShell.

A few open-source scripts to keep your NO-IP account happy (that also work on most other DDNS providers like Duck DNS):

Read the rest of this entry »

Posted in *nix, *nix-tools, bash, CommandLine, Development, Perl, PHP, Power User, PowerShell, Scripting, Software Development | Leave a Comment »

%d bloggers like this: