I’m becoming a huge fan of chocolatey and powershell for automation of my environment. Today I wrote a little script to complement my development environment with prey.
Prey lets you keep track of your laptop, phone and tablet whenever missing, whether you’re in town or abroad. Open source, proven software with hundreds of documented recoveries all around the world.
After the installation prey has to be configured. You can start the wizard in C:\Prey\platform\windows\prey-config.exe. This offers account creation and registration of your device. But what if you (like me) already have an account and the device registered?
Login on the prey website and retrieve the API Key (on account page) and device Key (on device details page). Change the values in the script below and after the installation the device is tracked again by prey.
cinst prey (get-content c:\prey\config) | foreach-object {$_ -replace 'api_key=.+' , 'api_key=''API_KEY'''} | foreach-object {$_ -replace 'device_key=.+' , 'device_key=''KEY'''} | Set-Content c:\prey\config
This piece of powershell is now part of my development environment setup.