Category: Tech

Tech related posts.

Powershell and MP3’s

I’ve been trying in vain to organize my substantial MP3 collection.  I know that in the age of streaming MP3’s are passe, but I just can’t quit ’em.  I listen to a lot of music that isn’t readily available for streaming.

One of the things I’m nitpicky about is Genre tagging.  I like that stuff to be correct.  Thing is, sometimes I get lazy.  So, I dug in to see if I could hack out a quick script to scan subdirectories in my collection and root out MP3’s with incorrect or missing Genre tags. This is a very raw little script with zero error handling.  It examines the first file in every subdir, and writes to an output file every directory where that first file’s genre tag doesn’t match what it should.  It requires taglib-sharp.dll.

# uses taglib-sharp.dll
[Reflection.Assembly]::LoadFrom("E:\taglib-sharp.dll")

$outfile = "outfile.csv"
$basedir = "I:\SORTED\Classic Rock"
$subdirs = Get-ChildItem $basedir -attributes D

foreach ($subdir in $subdirs) {
$file = Get-ChildItem $subdir.fullname -Filter *.mp3 | Select-Object -First 1
$ff=$file.fullname
$f = [TagLib.File]::Create("$ff")
$genre = $f.Tag.Genres
$outt = "$subdir `t $genre"
$outt
if ($outt -NotMatch 'Classic Rock') {
$outt | out-file $outfile -append
}
$f = ""
}

SQL Powershell tools

I’m not sure why MS makes it so convoluted to install these tools on a server that isn’t running SQL.  Regardless, head here:

https://www.microsoft.com/en-us/download/details.aspx?id=29065

And don’t click download.  All that gets you is a text file.  Instead, head down the page and expand Install Instructions.  From there, search for and download the following modules:

  • Microsoft® System CLR Types for Microsoft® SQL Server® 2012 (SQLSysClrTypes.msi)
  • Microsoft® SQL Server® 2012 Shared Management Objects (SharedManagementObjects.msi)
  • Microsoft® Windows PowerShell Extensions for Microsoft® SQL Server® 2012 (PowerShellTools.msi)

If you get a 2503 or 2502 error while trying to install, as I did, you may not have sufficient rights.  Try either killing explorer.exe and restarting it with admin privs or invoking the msi from within an elevated command prompt.

Then just install modules a la:

Import-Module sqlps -DisableNameChecking

Add Bookmark – Google Bookmarks, um, bookmark

In Chrome, create a new bookmark. Name it what you like and set its URL to:

javascript:(function(){var a=window,b=document,c=encodeURIComponent,d=a.open("https://www.google.com/bookmarks/mark?op=edit&output=popup&bkmk="+c(b.location)+"&title="+c(b.title),"bkmk_popup","left="+((a.screenX||a.screenLeft)+10)+",top="+((a.screenY||a.screenTop)+10)+",height=510px,width=550px,resizable=1,alwaysRaised=1");a.setTimeout(function(){d.focus()},300)})();

Click it when you’re on a page you’d like to bookmark (and make sure you’re logged into the Googlez).

Windows: Updating existing ODBC Data Source Drivers

For some reason there still isn’t any easy way to update the driver used on a previously defined ODBC data source in Windows. There’s no option when stepping through the configuration. I suppose you’re expected to delete and recreate the data sources, specifying the new driver at that time. But what if you have dozens, or hundreds, of existing sources?

Do it though the registry.
Continue reading

OpenVPN reconnect

My OpenVPN likes to have difficulty and go yellow from time to time.  The problem with this is twofold – I have any and all downloads stop at the absence of VPN, and when I’m not home connecting to my server is more difficult when VPN has hundged up.  The simplest fix for now is just to restart/reconnect VPN on the daily.

I use OpenVPN with PIA.
Continue reading

Windows 10 – Can’t enable System Restore

System Restore.JPG

For some reason on my most recent build of Win 10 (don’t get me started) the option to enable System Restore was grayed out.  I fixed it by running the following in a admin level CMD prompt:

reg delete "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\SystemRestore" /v "DisableSR" /f
reg delete "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\SystemRestore" /v "DisableConfig" /f
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SPP\Clients" /v " {09F7EDC5-294E-4180-AF6A-FB0E6A0E9513}" /t REG_MULTI_SZ /d "1" /f

The first two lines didn’t find those keys, FYI.  Still, the third enabled my ability to set up System Restore.