Chocolatey install prey

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.

preyPrey 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.

About erictummers

Working in a DevOps team is the best thing that happened to me. I like challenges and sharing the solutions with others. On my blog I’ll mostly post about my work, but expect an occasional home project, productivity tip and tooling review.
This entry was posted in Tooling and tagged , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.