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

    20140508-Delphi-2007--Project-Options--Cannot-Edit-Application-Title-HelpFile-Icon-Theming

    20140430-Fiddler-Filter-Actions-Button-Run-Filterset-now

    20140424-Windows-7-free-disk-space

    More Photos
  • Pages

  • All categories

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

    Join 1,714 other followers

Archive for the ‘PowerShell’ Category

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

–jeroen

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.

Source:

–jeroen

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.

–jeroen

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 »

PowerShell reads: links to coverage of One-Liners about PowerShell features (using, language, etc)

Posted by jpluimers on 2015/04/23

Boy, I wish I had read these PowerShell articles earlier:

  1. PowerShell One-Liners: Help, Syntax, Display and Files.
  2. PowerShell One-Liners: Variables, Parameters, Properties, and Objects.
  3. PowerShell One-Liners: Collections, Hashtables, Arrays and Strings.
  4. PowerShell One-Liners: Accessing, Handling and Writing Data.

Besides being in depth, the articles also contain a ton of examples all in this form:

Action Command Example
Basic help for x Get-Help cmd (cmd is a full name) help Get-ChildItem
Help in separate window Show-Command cmd; then select the help icon Show-Command Get-ChildItem

–jeroen

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

 
%d bloggers like this: