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

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 »

Determine Domain and username used when a network share was mapped

Posted by jpluimers on 2016/11/15

Need to research this a bit further as this works:

powershell gwmi -Query 'Select LocalName, RemoteName, UserName from Win32_NetworkConnection'
__GENUS : 2
__CLASS : Win32_NetworkConnection
__SUPERCLASS :
__DYNASTY :
__RELPATH :
__PROPERTY_COUNT : 3
__DERIVATION : {}
__SERVER :
__NAMESPACE :
__PATH :
LocalName :
RemoteName : \\w701ujpl\IPC$
UserName : EN81ENTx64SCAN\jeroenp
PSComputerName :

But this fails for some Powershell versions:

powershell
gwmi -Query 'Select * from Win32_NetworkConnection' | Select-Object LocalName, RemoteName, UserName, ConnectionState | Sort-Object LocalName | ft -auto

–jeroen

Source: user – Determine Domain and username used to map a network drive – Stack Overflow

Posted in Development, PowerShell, Scripting, Software Development | 1 Comment »

Update to List-Delphi-Installed-Packages.ps1 shows HKCU/HKLM keys and doesn’t truncated fields any more

Posted by jpluimers on 2016/08/24

I’ve posted an update to List-Delphi-Installed-Packages.ps1 that:

  • added HKCU/HKLM registry key values for each BDS version
  • doesn’t truncate fields any more when your console has limited width
  • is now in UTF-8 format so the BitBucket web-interface can show it

For the first two: Phry for helping me to force Format-Table to show more than 10 columns and pointing me how find out how to do this with Out-String so it doesn’t truncate fields; blog post about it will follow.

Now – as I can display more than 10 columns- I can start working in integrating all the other info about various BDS versions.

Source is at https://bitbucket.org/jeroenp/besharp.net/src/tip/Native/Delphi/Scripts/List-Delphi-Installed-Packages.ps1?fileviewer=file-view-default

A text dump of the current output is below.

–jeroen

via: If you need to know underlying information on Delphi versions « The Wiert Corner – irregular stream of stuff

Read the rest of this entry »

Posted in Delphi, Development, PowerShell, Scripting, Software Development | 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 »

How to determine XML type in Powershell – via: Stack Overflow

Posted by jpluimers on 2015/07/21

Brilliant! Cast to xml, if it is nil, then the second cast to bool will give false, otherwise true:

Thanks Shay Levy!

[bool]Get-Content c:\Path\To\xml_file.xml -as [xml]

–jeroen

via How to determine XML type in Powershell? – Stack Overflow.

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

 
%d bloggers like this: