/* BeejBlog */

KeePass + Cloud Storage = (near) Password Nirvana


Update 2015-09-27: Neato! In June of 2015 the author has applied a mod which allows for KeePassHttp to be served from somewhere other than localhost... there are security implications to be considered here but as long as you know how to cover your bases it opens some nice possibilities to have a single KeepPass instance provide password resolution to multiple clients... e.g. a VM guest, other machines in your home, etc. Not provided in ready to run plgx file yet but following the self compile instructions found in the readme was fairly trivial.

KeePass2 - Password management application
  • 10 years mature
  • Free
  • Windows, Linux, Mac, Android and iOS versions
  • DropBox compatible (Google Drive, etc)
  • Autofill browser plugins
  • Rich text area for notes (e.g. challenge phrases and other reminders)
  • Open source (.Net)


  • Mac (and Linux) can run the Windows.exe via Mono
    • Initially ran native KyPass Companion on the Mac side (~$8). Have since switched back to the free mainstream build (see below)
  • On Android phone using Keepass2Android (free) with solid results
    • Provides special keyboard which facilitates autofill
    • DropBox and other cloud drives well supported (synchronize)
    • Handy yet still secure Quick Unlock feature
    • Consider a good android lock screen as additional layer of protection

I’m glad I finally took the time.  I (forced ;) my wife to run the Windows version on her desktop and we share the same database file with our financial, healthcare, etc logins. So either of us can get into whatever we need wherever we are. It gives me peace of mind that she would have ready access to those important things in case I was somehow unavailable (knock wood). If you're putting up with some other convoluted hodge podge as I was, please give this general idea a shot by wading in slowly and see if it makes your life easier as it has for me.


 2013-01-01: My main password file was corrupted


and I couldn't log in.
  • Turns out I had a wonky entry that kept growing upon subsequent saves. Maybe compression algorithm was backfiring or something like that.
  • The offending entry was under KeePassHttp which just stores the authorized connection for each particular browser, so it was a no brainer to kill and recreate.
  • My kdbx file had grown to 28MB! after deleting it was back down to a measly 16k.
  • KyPass Companion was doing the most recent suspect saves causing massive growth so I can't help but wonder.

DropBox really shines
  • Thanks to DropBox's inherent versioning I could readily fallback to a working copy
  • Dropbox also showed the disturbing progression in larger file sizes over short amount of time
  • as well as which client that was driving those suspect saves - KyPass on my Mac
  • really gotta hand it to that product team, top notch stuff
KyPass's questionable involvement gave me a reason to give the mainline KeePass2 another look...

    Banging KeePass2 for OS X into shape
    • Updated from current v2.23 build to the latest official v2.24 build by dropping the latest KeePass.exe from the Windows zip bundle into the Contents/MacOS folder. This is promising; hopefully to never suffer the envy of a more recent build.
    • Contents/MacOS is also where plugins like KeePassHttp.plgx should be dropped.
    • KeePassHttp is working just fine for me running under this mono version.
    • Make sure to disable "Show a notification when credentials are requested" under Tools > KeePassHttp Options. Otherwise both KeePass and browser would freeze upon every login page request.
     Nice to have's in KeePass not currently available in KyPass Companion:
    • Automatic save-on-change (via triggers facility)
    • Autoload of the MRU kdbx file upon launch
    • Synchronization


    [SOLVED] Error: "The following plugin is incompatible with the current KeePass version"
    (/user/{username}/.local/share/KeePass/PluginCache/{unique}/KeePassHttp.dll)
    • Running on Mac via mono, turns out lldb is somehow the process forked by mono which hosts the KeePassHttp listener on port 19455
    • In my situation this pesky error was apparently caused by a crashed orphan lldb holding onto the port and blocking subsequent launches of KeePassHttp
    • Simply "KILLALL lldb" from terminal to resolve
    Debug notes:
    • mono>debug.txt -v /Applications/KeePass{version}/Contents/MacOS/keepass.exe
    • Noticed SocketException well into the KeePassHttp plugin's constructors call stack and started to realize the error message was misleading
    • Xamarin Studio will debug the running instance:
      • First, enable debugger break on SocketException: Run > Exceptions > enter SocketException in the search
      • Run > Debug Application > browse to keepass.exe
    • Xamarin Studio will also reverse gen back to C# source (not that we need it in this case but it's good to know for future) - just create a new project and add the assembly (DLL or EXE) as a reference and click into it to see the readable source conversion of all classes.

    JS Stack circa 2013Q4

    A few technologies that have crystalized in the last couple years really help bring javascript development up to parity with how robust things were under Silverlight & C#/.Net framework.

    • nuget - the tight integration that nuget brings to our whole universe is huge... at first nuget was new and like, neat that's "handy"... but at this point it would be total madness w/o it... searchable repository where all these new libraries are easily managed ... easy to check versions and update to the latest... bringing all these scripting dependencies into a project as formal "references" (just like .Net assemblies) really helps keep you out of javascript hell
    • requires.js - a fairly automatic "include"/dependency management system for all the interdependent JS libs that have to get pulled into the client at runtime... it used to just be jQuery but the JS lib stack has exploded out into literally dozens of includes that all piggyback eachother and w/o a management wrapper around that we'd have to get the <script> file references in the correct order on every browser page... another big potential for madness avoided
    • bundling & minification - the latest VS2012 MVC project templates come bundled with support for taking all these raw scripts and bundling them into one big file, this means the web client is only making one optimal request for it's "framework" rather than 20 async requests for each individual script library before it can start rendering the dang page page ... that big file is also "minified", meaning all the white space is removed so it's as small of a network download as possible... both of those together are pretty huge in the new scheme of things
    • "LESS" - basically CSS syntax revamped to support variables and generally less repetitive syntax ... it's a huge deal when you want to set some basic highlight colors & metrics and have everything else reference those as variables so that it's easy to change your look and feel by tweaking the core variables used in all the other element styles... it's easy to configure your MVC project to automatically compile LESS into native CSS for the browser to consume what it understands... there are other CSS wrapper syntaxes out there... SASS is another one
    • make sure you get the VS 2012 Web Essentials add on - it does all kinds of handy little nice to haves like automatically showing you you a little image popup when you hover over a reference (in CSS as well)... shows html color tags with a little color block popup... etc. etc.
    • Resharper - resharper is one of those cool kitchen sync productivity boosters that really makes me feel like i'm driving on jet fuel in visual studio... the automatic syntax cleaning it does... robust javascript parsing / intellisense / reference navigation and on and on

    HttpWebResponse from WebException

    using (var response = (HttpWebResponse)((Func<WebResponse>)(() =>
    {
      try { return(request.GetResponse());}
      catch (WebException ex) { return(ex.Response); }
    }))()) //<-- too funny
    using (var responseStream = response.GetResponseStream())
    // ReSharper disable once AssignNullToNotNullAttribute
    using (var readStream = new StreamReader(responseStream, Encoding.UTF8))
    {
      return String.Format("{0} {1}. {2}", (int)response.StatusCode, response.StatusCode, readStream.ReadToEnd());
    }
    

    [SOLVED] Acer Aspire One won’t boot Syslinux USB thumbdrive

    Looks like my particular issue was the default partition size on my 16GB thumbdrive. Once I formatted the USB with a 2GB partition and installed Syslinux to that, it booted up right away where previously it would hang on the first “Syslinux Copyright Peter Anvin” message.

    More details:

    • Acer Aspire One model#: 722-C62bb (looks like this is an 11” model)
    • Always handy to have another computer to work from (for web searching, trial and error formats on the USB drive, etc) when trying to fiddle with boot issues on another… my other computer is a Win8 desktop.
    • Syslinux actually came into my picture because I was looking to create Comodo’s Rescue Disk. Comodo (v6.2) has a convenient point and click process to push their linux based rescue disk to a USB.
    • I used diskpart (on my Win8 box) to create the smaller partition… here’s the core commands:
      • list vol (to get a feel for your windows drive letters and not format the wrong one :)
      • list disk (same for raw physical disks)
      • select disk X (MAKE SURE YOU CHOOSE THE RIGHT ONE!!)
      • (MAKE SURE AGAIN)
      • clean (THIS WIPES THE DISK!!!)
      • create part primary size=2048 (2GB worked for me in this context)
      • active
      • format fs=fat label=”COMODO” quick (I chose old school FAT filesystem looking for most downlevel compatibility, not sure if it was actually necessary vs FAT32. NTFS is notably the least compatible option for linux booting. Quick means do a quick format.)
    • Then I just let Comodo do it’s thing and that result booted up right away for me – yay :)

    Man Cave Bling - Beer Fridge - Koldfront 80 (BBR900BL) by EdgeStar

    View larger image of Koldfront 80 Can Built-In Beverage Cooler - Black

    • First one was a dud out of the box. Just didn’t cool at all. EdgeStar support said it was missing coolant. Took them about 2 full weeks to turn around the replacement. They paid all replacement shipping via printed return label. It was a new serial number, not a repair of my old one, and it looked new.
    • I am very satisfied now with this second unit and would definitely recommend it.
    • The look is very nice. The glass is great. The blue light is great.
    • The size is great, very deep. Fit my under-the-bar-cabinet-slot really well. A little shorter than the broken down old “Scotsman” that was in there but nothing a couple 2x4’s didn’t fix.
      • Sure am glad to have found something in a more reasonable price range… I’m sure the Scotsman stuff must last forever but at upwards of $2k, not on my kids’ college budget :)
    • Cooling has been spot on for the 2 months I’ve had it so far <knock wood>.
    • The cheapest I was able to find it was from “Ideal Wine Coolers” for $400. Half retail and $100 less than Amazon.
    • Other considerations for this same general form factor are the:
      • “EdgeStar 80” (CBR901SG) for $500 if you’re interested in the stainless steel look, and the
      • “EdgeStar 84” (OBR900SS) for $750 if you want outdoor certified cooling capabilityDSC_0991-50%… they indicate that a unit should be specifically designed to run outdoors or it will burn itself out quickly running non stop… that one would look great next to a hot tub :)

    DSC_0967-50%

    What’s this? A pretty decent “Time Machine” built into Win8!?

    image
    http://lifehacker.com/5958865/how-to-use-windows-8s-new-file-history-backup-aka-time-machine-for-windows
    i've always considered the Vista/Win7 "previous versions" facility to be pretty similar to Time Machine just lacking Apple's meticulous care to making it drop dead easy to use.
    i hadn't yet noticed the MS boys had taken yet another swipe at simplifying the UI in Win8... i'm assuming there's still a usability gap that the Mac boys can laugh at us, but gee, first impression is "not bad Balmer you ol’ dog”
    1. search for "file history" in win8 home screen
    2. fire up the ui
    3. select my backup drive
    4. click the "turn on" button
    5. in normal explorer window right mouse all my favorite folders and add them to the documents "library" - since that's included in what gets backed up (libraries are those fancy pants folder buckets that came along probably with Vista)
    6. click the "run now" link
    7. click "restore personal files" link and yep sure enough all the stuff is piling up out there
    defaults to hourly file versions, just like time machine, but can be readily bumped down to minutes in obvious "advanced settings" UI if you want, just like time machine.
    the restore UI is clean simple and has exactly what I'd want/expect out of the box... a standard folder explorer big current time stamped version at the top and previous, next and a big restore button (see attached)
    not bad i say, not bad at all... 'bout f'ing time.




    Light Custom Configuration Section

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Configuration;
    
    namespace WebServiceClient
    {
        /*URLElement class below represents a bundle of properties (URL, password, etc) for each endpoint we need to send to... 
      
        And the following custom app.configuration section allows us to maintain a list of these URLElements. 
        copied from here: http://www.abhisheksur.com/2011/09/writing-custom-configurationsection-to.html 
        and here: http://stackoverflow.com/questions/1755421/c-sharp-appsettings-is-there-a-easy-way-to-put-a-collection-into-appsetting 
        The basic gist is 3 fairly light implementation classes -- 
        URLElement = individual elements, URLCollection = collection of elements, and URLSection = new custom app.config section. 
        */
        public class URLSection : ConfigurationSection
        {
            //nugget: it seems that the [ConfigurationProperty()] attribute does not work on a static property (maybe that's true for all attributes??), 
            //so the _URLs *instance* propery satisfies this attribute requirement, but made it private since don't plan on using it directly. 
            //then exposing the URLs collection as a public *static* property. 
            //this rigamarole merely allows for the slighty more succint "URLSection.URLs" from the calling code rather than "URLSection.urlSection.URLs" 
            public static URLCollection URLs { get { return _urlSection._URLs; } }
    
            [ConfigurationProperty("URLs")]
            private URLCollection _URLs { get { return this["URLs"] as URLCollection; } }
            private static readonly URLSection _urlSection = ConfigurationManager.GetSection("URLSection") as URLSection;
        }
    
        //nugget: the xml tag name of the element level nodes must be "" by default 
        //to change to something else, it looks like one must implement a few more overrides like the ElementName & ConfigurationElementCollectionType properties. 
        //leaving it as the default seems just fine for current needs. 
        public class URLCollection : ConfigurationElementCollection
        {
            public URLElement this[int index] { get { return (URLElement)BaseGet(index); } }
            protected override ConfigurationElement CreateNewElement() { return new URLElement(); }
            protected override object GetElementKey(ConfigurationElement element) { return ((URLElement)(element)).Name; }
        }
    
        public class URLElement : ConfigurationElement
        {
            [ConfigurationProperty("Name", IsKey = true, IsRequired = true)]
            public string Name
            {
                get { return (string)this["Name"]; }
                set { this["Name"] = value; }
            }
    
            [ConfigurationProperty("Url", IsRequired = true)]
            public string Url
            {
                get { return (string)this["Url"]; }
                set { this["Url"] = value; }
            }
    
            [ConfigurationProperty("ContextID", IsRequired = true)]
            public string ContextID
            {
                get { return (string)this["ContextID"]; }
                set { this["ContextID"] = value; }
            }
    
            [ConfigurationProperty("Password", IsRequired = true)]
            public string Password
            {
                get { return (string)this["Password"]; }
                set { this["Password"] = value; }
            }
    
            [ConfigurationProperty("IgnoreWebServiceException", DefaultValue = false)]
            public bool IgnoreWebServiceException
            {
                get { return (bool)this["IgnoreWebServiceException"]; }
                set { this["IgnoreWebServiceException"] = value; }
            }
    
        }
    
    }
    

    [SOLVED] SSRS (2012), Excel export, “Not a legal OleAut date” error

    Wound up being related to executing TimeSerial(0,0,secs) when specified secs represented more than 24 hours. Somehow the Excel rendering pipeline was the only one out of the various export formats that was susceptible to this issue which is interesting. From the TimeSerial specs I don’t see anything inherently invalid about going that high… the docs indicate it simply rolls it into the day portion of the resulting value as I would expect. Given that the error refers to “Ole”, there is some other intermediate data type conversion going on here… perhaps it passes through a time only type???

    Trailer Hitch Bike Rack

    440

    After fair amount of homework, went with the Softride “Element” 4-bike rack… pricing is consistently $210’ish and I went with my local REI for solid local support.

    Was torn between this Element and the $70 more big brother “Dura” model… which adds “anti-sway cradels” (i.e. seat tube rubber wraps) + built in lockup cable + hitch bolt lock + beefier + 5 lbs… I’m thinking I’ll be good at rigging my own anti sway (via old inner tubes & bungees), the rest really didn’t appeal to me and (I presume since we chose the low end 4 cyl. Kia Sportage for it’s gas mileage) I was unpleasantly surprised to discover that I have to use the 1-1/4” hitch extender - so the less weight/torque the better.

    Notable feature of the Softride line is its parallelogram bars that keep the bikes perpendicular to the ground when you lean the rack away to open your lift gate... Yakima/Thule hasn't copied that yet… and the only other means for simple tail gate access out there are $600 plus “swing away” style that really look clunky to me. If this sounds useless to you, fine but I feel like it's "last inch" convenience like that which helps things slump over the swear words threshold when you just want to get something out quickly and get going.

    There are a couple higher end models to be aware of if you’ve got cash to burn: a lighter aluminum one and a hydraulic Assist model that helps raise back into locked position… cool but my sweet spot is lower end.

    The Softride’s are a great price against the field... one can easily hit $300, $400 , $600 for no great reason... I've read a lot about these on Amazon etc and am thoroughly prepped to be careful/creative with rubber straps that seem to be highly prone to tearing … but the metal parts and basic functionality are reported solid across the board.

    Roof Cargo Box

    yeah, i know, really poor iphone photo :(Installed this last night... found in local Pep Boys inventory… blasted them with a $20 coupon that expired that day :) so was out the door at $210 + tax.

    This PepBoys SKU is barely a rebrand of the SportRack “Voyager XL”… the manual inside is OEM, headered with “90274 Voyager XL” and “A90275 Aero XL”… one forum I read said this bugger gets down around $100 sometimes during PepBoys promos… something to keep an eye on.

    Dimensions: 35 pounds (doesn’t feel like it), 18 cubic feet (this is the max end of the range from what I could see), 62 x 39.5 x 19 inches. We have a “mountain buggy” stroller & kiddie trailer that are in the 31” width, 45” length, 15” height (when flat) range so this opens the possibility of tossing up there if we want to suffer the inconvenience – more likely for a longer trip with a nice long usage window between load and unload.

    Caveat: The lid “spring lift” hinges are mostly plastic. They feel pretty fragile. I expect to break them eventually (vacation stress induced daddy hulk-out moment ).  I feel this is the primary sacrifice vs more expensive, beefier models. I look at it as a convenience for as long as it lasts and the box should still be functional after that, simply requiring manual prop open.

    Note: SportRack is a Thule acquisition circa 2005.

    This same basic model goes for a big range of prices under different names:

    • over $500 as the A90275 Aero XL on Amazon for no good reason.
    • Or only $280 as the SR7018 Vista XL.
    • Walmart carries it as Aero XL for $300 and $250, take your pick haha.

    quick release kitIt was very straightforward to install… a few casual minutes, very doable by one person as long as you can lift it up there. The u-bolts are simple and practical… I am however hoping this $30 quick release kit will let me pop it on/off a little faster so we can garage the SUV w/o hassle… will report back on that.

    [Update 2013-08-02] Ok I can now recommend the quick release kit. It’s not what I would call nirvana but it’s definitely more convenient than the stock brackets. They’re just as sturdy as stock bracket when tightened down, no concern of slippage. If you look at the picture to the right, with the metal plates numbered 1,2,3 from top to bottom – ones roof rack cross bars fit between plates 2 & 3. The “quick” part of this is that one bolt always remains connected to plate 3 and one bolt is free, creating an opening for the cross bar insertion and subsequent removal. Simply because one bolt stays connected, the hardware is always attached to the cargo box and more ready to go, unlike the stock u-bolts which must be completely separated from their nuts to remove the cargo box from the roof. Hopefully that makes sense enough to satisfy your purchase anxiety. It’s pretty obvious what has to happen when you get it in front of you.

    Lastly, the one other tempting unit I saw out there in this bargain range is the X-Cargo Sport 20 currently for $180 at Sears. It wasn’t stocked locally for me at the time, and Sears’ shopping cart indicated $90 to do the oversized shipping. This unit is worthy of consideration based on size and price. 20 cubic feet is the biggest I’ve seen. 67.5 x 36.25 x 20.25 inches, same 35 lbs.

    Follow-up after 3 months usage – We’ve been very satisfied with the size and performance. No recognizable wind resistance driving impacts. The rather prominent Pep Boys decal on the back face peels right off if that doesn’t fit your vanity profile :)

    Mockup / Wireframe / Prototype Tools

    Balsamiq “Mockups”

    Pencil

    Gliffy
    • free basic web functionality
    • $$ubscription model for featured version
    SketchFlow is apparently coming back to VS2012 – Microsoft seems to be in a bit of a tizzy buttoning down all the loose ends in the latest transition to all things immersive.
    Infragistics has Indigo Studio
    There’s tons more out there… prototyping is apparently a very hot item

    iTunes finally has “add to play up next”

    WHY did that take till 2013?!?
    Can’t believe they whacked CoverFlow in iTunes 11… I guess I’ll probably forget how much I liked the full screen CoverFlow eventually but man what a wild judgment call on Apple’s part there.
    image

    DST T-SQL

    -- this code returns the start and end datetime’s for DST in the current year
    -- DST begins at 2am on the SECOND SUNDAY of March and ends the FIRST SUNDAY of November
    
    SELECT 
      DATEADD(HOUR, (MULTIPLIER + 7 /*skip the first week*/) * 24 /*24 hours a day*/ + 2 /*offset to 2am*/, StartWeek) AS StartDate, 
      DATEADD(HOUR, MULTIPLIER * 24 + 2, EndWeek) AS EndDate 
    FROM ( 
      SELECT 0 AS MULTIPLIER, 1 AS DOW UNION ALL 
      SELECT 6, 2 UNION ALL 
      SELECT 5, 3 UNION ALL 
      SELECT 4, 4 UNION ALL 
      SELECT 3, 5 UNION ALL 
      SELECT 2, 6 UNION ALL 
      SELECT 1, 7 
    ) dow, 
    (SELECT 
      '03/01/' + convert(varchar, DATEPART(YEAR, GETDATE())) AS StartWeek, 
      '11/01/' + convert(varchar, DATEPART(YEAR, GETDATE())) AS EndWeek 
    ) DST 
    WHERE DATEPART(WEEKDAY, StartWeek) = DOW
    

    Enable SSL Connections to SQL Server

    “SQL Server Transport Encryption” is a good Google phrase for this technology.
    Reference: http://msdn.microsoft.com/en-us/library/ms191192.aspx

    Obtain an SSL Certificate

    A self signed certificate is easy and works fine... here’s one way:
    • Get the IIS 6.0 Resource Kit Tools: http://www.microsoft.com/download/en/confirmation.aspx?id=17275
    • All you'll need is the "SelfSSL.exe" tool so the custom install is minimal.
    • Find SelfSSL.exe in default install path: C:\Program Files\IIS Resources
    • Good reference for SelfSSL usage: http://www.sslshopper.com/article-how-to-create-a-self-signed-certificate-in-iis-7.html, scroll down to "Generate a Self Signed Certificate with the Correct Common Name"
    • Command line example:
      1. SelfSSL /N:CN=MWR-TRO-V2 /V:1999999
      • The /V: part is the validity duration of your cert, in days. I believe 1999999 is the max, which corresponds to around 5475 years in the future (that ought'a last ya ;)
      • The /N:CN= part is the “Common Name” this cert will be tied to… in this case that needs to be the true machine name of your database server.
    • “Do you want to replace the SSL settings for site 1 (Y/N)?” => No
    • Now you have a cert registered in your “personal certificate store” - next we’ll extract it for installation on db server.
    Fire up the MMC “Certificates Console” to manage your new cert

    • Good reference: http://support.microsoft.com/kb/276553)
    • Open the MMC console: Start > Run > mmc [enter] (or Windows-R) (MMC Fig.1)
    • Add the cert snapin: click File > Add/Remove Snap-in (MMC Fig.2)
    • select Certificates under Available snap-ins… and hit Add button… (MMC Fig.3)
    • select Computer Account… then Next… (MMC Fig.4)
    • select Local computer, and then Finish… (MMC Fig.5)
    • lastly, hit OK (MMC Fig.6)
    • You may wish to save this MMC configuration for future convenience (MMC Fig.7)
    Screenshots...

    Export the cert as a pfx file

    …to be installed on your database server

    • Certs installed via the above process will be your "Personal > Certificates" folder (Export Fig.1)
    • Right mouse desired certifcate > All Tasks > Export > Next ... (Export Fig.2)
    • “Export the private key?” => Yes … Next… (Export Fig.3)
    • Select PFX format, "Include all certs...", "Export extended", NOT “Delete…”, Next … (Export Fig.4)
    • Enter a password, hit Next… (Export Fig.5) – ** REMEMBER THAT PASSWORD **
    • Save the pfx file (Export Fig.6)
    • Finish… OK (Export Fig.7)
    Screenshots...

    Import cert on database server

    • Login to your DB server desktop
    • Launch MMC Cert Console same as above
    • Go to Personal > Certs
    • Right mouse All Tasks > "Import"… (Import Fig.1)
    • Next… (Import Fig.2)
    • Browse… (Import Fig.3)
    • Next … (Import Fig.4)
    • Enter Password, select “Mark this key as exportable”, Next… (Import Fig.5)
    • “Place all certificates in the following store” => Personal… Next… (Import Fig.6)
    • Finish (Import Fig.7)
    Screenshots...

    Activate SSL encryption on DB server

    • Fire up SQL Server’s Network Configuration Utility
      • Start  > All Programs > Microsoft SQL Server {version} > Configuration Tools > SQL Server Configuration Manager" 
    • then under "SQL Server Network Configuration"
    • Right click "Protocols for MSSQLServer"
    • select "Properties"
    • set  "Flags tab > Force Encryption" to Yes
    • and select the installed cert on the "Certificates" tab
    • voila!
    • STOP AND RESTART THE SQL SERVER SERVICE
    • login to the instance with an SSMS Query window
    • fire this command to verify all connections are encrypted:
      1. SELECT encrypt_option, * FROM sys.dm_exec_connections WHERE session_id = @@SPID
    • Tip: SP_WHO2 is handy for obtaining spids

    Recovering failed SQL Server 2012 Installation

    • I have to say, SQL Server’s setup.exe seems pretty dang fragile… I realize it’s a complicated script with endless dependencies and such, just saying… year after year I continue to run into various reasons that the setup twists it’s ankle on something, bombs out midstream and leaves behind a partial installation mess that can’t be repaired or uninstalled… maybe I’m just unlucky or perhaps I’m overly hard on poor old Windows.
    • This most recent bout was SQL Server 2012 on Windows 8… a lot of this stuff hasn’t changed all that much since SQL Server 2000… I’ve had success with most of these commands when SQL Server 2005 – 2008R2 installs have gone sour on me in the past.
    • This is primarily an exercise in mule headedness… I wouldn’t look to this as a real resolution to a production problem… I wound up with a running SQL Server and SQL Agent after an hour or so of banging but God only knows what other problems and missing chunks could still be lurking when I try to fire up other peripheral services like Service Broker, Database Mail, etc.
    • During my SS2012 install on what I thought was a fairly fresh Win8 machine, SQL Browser was the original failure… ProcessMonitor showed me that the setup script was cranky about a missing a key around here:
      • HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SQL Server\90\SQL Browser … note the interesting WoW subtree
    • I read a fair bit about various reg keys confusing the SQL Server installer and soon found myself unable to resist the sledgehammer urge … blowing away all reg keys and c:\program files under “Microsoft SQL Server” just feels right ;)
    • of course the next install didn’t go so hot either… next error was something about “MOF” and “WMI”… Googling yielded no silver bullets…
    • eventually realized that the main SQL Server service was actually “installed” to some degree but in a non happy state… hmmm… I’ve been here before… let’s keep throwing some wrenches at it…
    • first up, the SQL Server service wouldn’t start …
    • managed to get some help from launching SQL Server exe via command line: C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER2012\MSSQL\Binn>sqlservr.exe –sMSSQLSERVER2012
      • note that my chosen SQL Server instance name is “MSSQLSERVER2012” so you’ll need to substitute that with your own, or none at all if you are using default instance
      • was getting errors like this:
        2013-02-02 12:08:26.74 Server      Error: 17058, Severity: 16, State: 1.
        2013-02-02 12:08:26.74 Server      initerrlog: Could not open error log file ''. Operating system error = 3(The system cannot find the path specified.).
    • got sqlservr.exe to run a little further by specifying the errorlog path parm:
      • -e"C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER2012\MSSQL\LOG\ERRORLOG"
    • Next errors made me realize I needed to provide all the missing system databases by copying them
      • from: C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER2012\MSSQL\Binn\Templates
      • to: C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER2012\MSSQL\DATA
      • and specify the master.mdf/ldf via command line:
        • –m”C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER2012\MSSQL\DATA\master.mdf"
        • -l"C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER2012\MSSQL\DATA\mastlog.ldf"
    • Next errors were like this:
        2013-02-02 12:54:59.13 spid4s      Starting up database 'msdb'.
        2013-02-02 12:54:59.13 spid8s      Starting up database 'mssqlsystemresource'.
        2013-02-02 12:54:59.14 spid4s      Error: 17204, Severity: 16, State: 1.
        2013-02-02 12:54:59.14 spid4s      FCB::Open failed: Could not open file e:\sql11_main_t.obj.x86release\sql\mkmastr\databases\objfre\i386\MSDBData.mdf for file number 1.  OS error: 3(The system cannot find the path specified.).
        2013-02-02 12:54:59.14 spid4s      Error: 5120, Severity: 16, State: 101.
        2013-02-02 12:54:59.14 spid4s      Unable to open the physical file "e:\sql11_main_t.obj.x86release\sql\mkmastr\databases\objfre\i386\MSDBData.mdf". Operating system error 3: "3 (The system cannot find the path specified.)".
        2013-02-02 12:54:59.15 spid4s      Error: 17207, Severity: 16, State: 1.
        2013-02-02 12:54:59.15 spid4s      FileMgr::StartLogFiles: Operating system error 2(The system cannot find the file specified.) occurred while creating or opening file 'e:\sql11_main_t.obj.x86release\sql\mkmastr\databases\objfre\i386\MSDBLog.ldf'. Diagnose and correct the operating system error, and retry the operation.
      • I’m gathering this “e:\sql11_main_t.obj.x86release” path was where all the temporary files sat during installation… I haven’t been able to track down where that path is stored in order to set it right… for now I took the easy way out and simply created a symbolic link from that bogus path to my C:\ path and as they say, robert is your father’s brother.
    • Next problem was that the failed installation hadn’t gotten to the point of establishing any of the sysadmins logins… so couldn’t get SSMS to connect to the instance … I’ve actually run into this before… it’s not that bad to work around *IF* you can log into windows as the builtin “Administrator” account…
      • start sqlservr.exe in single user (aka maintenance mode) via: sqlservr.exe –m {plus all other parms previously mentioned}
      • enable your local Administrator account via cmd: net user administrator /active:yes
      • then login to Windows as Administrator (switch user)
      • fire up SSMS under this account and you should now be able to connect to your cranky SQL Server instance
      • add your missing sysadmin logins… e.g. sa, “BUILTIN\Administrators” and anything else you want… note: the NT account browser doesn’t display “BUILTIN\Administrators” in the list but it worked fine entered manually.
      • now you can logoff your Administrator account, switch back to your preferred login, stop sqlservr.exe via CTRL-C, start it back up in normal mode (without –m) and you should be able to connect normally
    • To get the service to start normally you could enter the –e, –d, –l parms on the service command line but I found that it is registry entries that normally provide these defaults so I went that route:
      • HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL11.MSSQLSERVER2012\MSSQLServer\Parameters
        • add string value: SQLArg0
          • -dC:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER2012\MSSQL\DATA\master.mdf
        • SQLArg1 = –e{path}
        • SQLArg2 = –l{path}
    • The last annoyance laughing in my face was the SQL Agent… Service not even installed.
      • here’s the command line that wound up having the right footprint to make SSMS recognize a happy SQL Server Agent node:
        • sc create SQLAgent$MSSQLSERVER2012 binPath= "C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER2012\MSSQL\Binn\SQLAGENT.EXE -i MSSQLSERVER2012" type= own start= auto depend= netbios DisplayName= "SQL Server Agent (MSSQLSERVER2012)"
      • I think this reg key was also crucial:
        • HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL11.MSSQLSERVER2012\SQLServerAgent
          • “ErrorLogFile” (String Value) = C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER2012\MSSQL\LOG\SQLAGENT.OUT
      • everything seems to be fairly in order but I do see some evidence of a few remaining missing chunks when I browse the SQL Agent properties under SSMS… hopefully I don’t really care about those settings
      • couple other tips:
        • you can run C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER2012\MSSQL\Binn\SQLAGENT.EXE from command line to get some clues
        • -c tells it to run as a standalone exe outside of the service control manger
        • -v is verbose output and looks useful
        • -I is the SQL Server instance designation
    • One remaining annoyance is that that SQL Server Network Configuration nodes are all empty under the SQL Server Configuration Manager console… no errors, just empty… supposedly this is tied to the “Client Tools Connectivity” installation item but I’ve remove/re-installed that successfully, to no avail… would love to hear how to recover this management panel functionality.