Thursday, March 28, 2019

 

Switching password managers: PowerShell to the rescue

As if dropping your beloved password manager and starting with another product wasn't hard enough, there is also the challenge of moving credentials to a new system. For many years I have been a happy RoboForm customer. The password manager integrated nicely with all browsers I use, had an easy to use interface and a flexible password generator, and with some fiddling also allowed selectively sharing family passwords on some computers only.

Photo credit: Image by Jan Alexander from Pixabay

The integration with Firefox deteriorated when legacy extensions were dropped from the browser, and the new RoboForm extension never quite reached the same ease of use and consistency in the user interface. Time had come to look into alternatives, and the choice was a combination of KeyPass, the the popular open source product, and 1Password, an the enterprise ready solution that supports shared vaults for families and teams.

The migration seemed easy: RoboForm does have CSV export capabilities, although somewhat hidden in the latest version, and 1Password claims the ability to import RoboForm CSV files, only after a few attempts the results were mixed, to say the least. Some userids ended up in the password fields, and multiline notes were interpreted as tags. Clearly something wasn't right. 1Password support explained that the format seems to have changed recently, with RoboForm now exporting cards with the fields ordered as

Name,Url,MatchUrl,Login,Pwd,Note,Folder,Rf_fields

whereas 1Password expects

Name,MatchUrl,Login,Pwd,Note,Folder,Rf_fields,Url

That's where my new affection for PowerShell comes into play. This would have entirely doable in REXX, Perl, Python or any other language I have used for reformatting data, but parsing and generating CSVs can be tricky to implement or require additional modules. Not so in PowerShell, where the conversion from an arbitrarily ordered CSV with headers is a simple one-liner:

Import-Csv -Encoding UTF8 -Path $infile | Select-Object "Name", "MatchUrl", "Login", "Pwd", "Note", "Folder", "Rf_fields", "Url" | Export-Csv -Encoding UTF8 -NoTypeInformation $outfile

And voilà, all data automagically ends up in the right fields.

Labels: , ,








Page tools



Archives