PowerShell as a Backup Solution

This is a quick PowerShell (PS) way of creating backups for your documents.

I have another post that uses robocopy. I tend to like the robocopy solution more because it can be smarter about copying files only if they don’t already exist in the destination (the backup location).

On the backup location, place the code below on a text file named backup.ps1.

# the line below stops the execution of the file when a
# line errors out
$ErrorActionPreference = "Stop"

$folderName = ".\$((Get-Date).ToString('yyyy-MM-dd'))"

echo "---- Creating dated folder"
New-Item -ItemType Directory -Path $folderName

echo "---- Copying C:\home\docs into dated folder"
Copy-Item C:\home\docs $folderName -recurse -Force

Edit and add the lines that start with Copy-Item so they copy the folders you are interested in.

On the same folder that contains backup.ps1, create a text file named run-backup.bat and make it have these contents:

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy ByPass -File backup.ps1 > last-execution.log 2>&1

run-backup.bat makes it so

  • You don’t get an error saying “backup.ps1 cannot be loaded because running scripts is disabled on this system. See about_execution_Policies”
  • The output of backup.ps1 makes it to the last-execution.log file

Getting Git to work with a Self Signed or Corporate Issued Certificate

If you’re getting this error when using Git on the command line or in Visual Studio:

fatal: unable to access ‘https://myserver/tfs/DefaultCollection/_git/Proj/’: SSL certificate problem: unable to get local issuer certificate

This post is just for you!

The issue is that Git does not trust the certificate from “myserver”. To get git to trust it, you must set it up on Git’s certificate store.

Step 1: Getting the root certificate

  1. Open Chrome and type https://myserver (where I work it’s https://tfs )
  2. Hit F12
  3. Go to the Security Tab
  4. Click “View certificate”
  5. Go to the “Certification Path” tab
  6. Select the root certificate (at my work it’s CTAC-DR0-RCA….)
  7. Click “View Certificate”
  8. Go to the “Details” tab
  9. Click “Copy to File”
  10. On the step that asks “Select the format you want to use:”
  11. Select “Base-64 encoded X.509 (.CER)”
  12. Save the certificate on your computer, you will need it in a further step. I called it ctac-root.cer

Step 2. Add the root cert to git’s certificate store

  1. This will make the error go away from the command line. If you only want to fix it for Visual Studio, go to Step 3.
  2. Go to C:\Program Files\Git\mingw64\ssl\certs\
  3. Copy ca-bundle.crt to ca-bundle.crt.orig as a backup
  4. Open ctac-root.cer (created in step 1)
  5. Open ca-bundle.crt in a text editor
    • Since you will edit it, open it in a program as an administrator.
    • If you are not an admin of the box, follow this post to make a user specific certificate store.
  6. Append the contents of ctac-root.cer (created in Step 1) to the end of ca-bundle.crt

Step 3. Add the root cert to Visual Studio’s Git certificate store

  1. Follow the instructions in Step 2 with the ca-bundle.crt found on C:\Program Files (x86)\Microsoft Visual Studio\2017\[Enterprise|Professional]\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\Git\mingw32\ssl\certs

You’re all set!

Installing “Active Directory Users and Computers”

I often need to know what users belong to an AD group. To do this you need to install the “Active Directory Users and Computers” feature.


This feature comes as a part of the “Remote Server Administration Tools for Windows 10” installer.

After installing it you can open it by hitting the Windows key and typing “Active Directory Users and Computers”. You can then right click the AD node on the left and select “Find…”.

Google’s Project Fi will not save you from bad cell reception at your home

The only cell phone network with decent signal at my house is Verizon. Verizon is an OK company; they have good customer service. My only complain is they are expensive.

I love the Google ecosystem so I got very excited when I heard about Project Fi. I waited until the Nexus 6P’s price dropped (when The Pixel came out) to switch over to Project Fi.

One of the big features of Project Fi is that it can switch from Wi-Fi to cell towers (of 3 cell networks) seamlessly while you have a call going on. And it can also switch from any of the 3 cell networks seamlessly picking the one you have best reception with.

I made the switch over to Fi.

It was no surprise to me that the 3 cell networks Fi is currently partnered with (Sprint, T-Mobile, U.S. Cellular) had less reception than Verizon.

But this is where Google Fi began to fail for me: It is not smart enough to know that my Wi-Fi quality is better than the cell tower quality. From my home, it still tries to use the towers even though the tower call quality is unacceptable.

I called Fi support to complain and they mentioned they could update my settings so Wi-Fi took precedence over cell towers. It was annoying to have to call to get them to do what I thought the phone would have done on it’s own based on the advertising on Fi’s website. It was also disappointing that it was always going to choose Wi-Fi when it was available as opposed to finding the best call quality comparing both Wi-Fi and cell towers.

Then came the final disappointment. All Wi-Fi calls have a strange echo heard by the non-Fi person on the call. At this point all my calls at home were going through Wi-Fi; I thought this was going to work out great. But then we noticed that the person on the other side of the call would ALWAYS hear a 1 second delayed echo of themselves. Everyone thought it was annoying and some could not even talk to me because they were so distracted by listening to their voice.

This echo was experienced also on Google Hangouts calls. Others (see here and here) are experiencing the same thing. Wi-Fi calls with Skype, WhatsApp, and Boss Revolution work fine even though support tried to blame it on all Wi-Fi calls for a little while.

Sadly, I had to cancel the service. Cell phone call quality is already crappy (compared to the good old land lines) when things are working as expected; anything worse than that is unacceptable.


Why I went back to Android from iPhone

I’m a long-time Android power user. I’ve been using Android for about 10 years now and always wondered why some people loved iPhones. So I decided to try one out. My plan was to stick to the phone for 6 months to make sure I gave it a good shot; but after 2 months of using it; I decided it was not worth it and went back to Android.

The phones I compared were an iPhone 7 and a Samsung Galaxy S7.

The iPhone 7 was not all bad. Here are the areas where it felt superior (note they are all hardware related):

  • Camera is slightly quicker
  • Finger print scanner is quicker

Here is where Android was superior (note they are all software related):

  • Back button
    • The placement is the same across apps.
    • You can always reach it with your thumb where the optimal grip of your phone is not jeopardized
      • the iPhone has it at the top left or top right. Both places are not optimal for how common you do this action.
  • You can customize the position of your home screen icons.
    • the iPhone only lets you customize the sort, but they are always positioned from top to bottom. And again, the top of the phone is really hard to reach; why do they force their users to use it?
  • You can install apps from the web browser
    • On the iPhone, all your app research has to be done either on the phone or on iTunes, none of which let you open multiple tabs at the same time.
  • Custom mp3 ringtones are easy to set up.
    • On the iPhone you need iTunes and the ringtone has to be converted to a spceific codec. I was not able to convert my special mp3 ringtone to that format; not sure why.
  • Does a better job at embracing the cloud
    • You can access all your photos/documents on any device (pc, phone, tablet) that has a web browser.
      • This means you can go to your buddy’s computer and just log in to a website to see all your photos. Same thing with your documents, spreadsheets, etc.
    • The iPhone also syncs things to the cloud but they are not that easily accessible from devices that are not yours.
  • Allows you to install apps that can read/send text messages.
    • This enables magnificent apps like MightyText where you can enter the text message on a web browser running on a desktop and send it through your mobile phone.
    • The iPhone allows you to send text messages from a desktop or laptop but you have to use their apps that only run on Mac OS. This means the desktop or laptop has to be a Mac.
  • This one is very worthy of a bullet: You don’t have to use iTunes.
    • Granted that you really only need iTunes to do power user things on your iPhone.


Both are good phones and operating systems.

The iPhone has superior hardware. If you don’t like to customize things and you use your phone mostly for normal things (phone, calendar, maps); you will prefer this phone.

Android has a superior UI and is way more customizeable. If you are a power user that enjoys tons of app choices; this is definitely the phone for you.

Analyzing IIS C# Memory Leaks

There comes a day in a developer’s life when you have a memory leak. This is not too common in the C# world but it happens. When it happens it is usually in production; and it spoils your day for sure.

In this post I’ll show you how to get a memory dump of the IIS process running your website (application pool) and then I’ll show you how to open it an analyze it.

Step 1: Getting the Memory Dump

Go to the server (production, staging, dev, wherever) where the memory leak is happening.

  1. Open up the Task Manager
  2. Click on the Details tab
  3. Right click on any of the existing column headers (name/PID/status)
  4. Click on “Select Columns”
  5. Check the “Command Line” column and hit OK
  6. Sort the list of processes by Name
  7. Find all the w3wp.exe processes
  8. Identify the one running your app pool by looking at the “Command line” OR “User name” column
  9. Right click on the process
  10. Click “Create dump file”

Step 2: Analyzing the Dump File

There are several tools for analyzing Dump Files. Visual Studio (VS) has that functionality as well and chances are you already have VS installed on your machine.

To see the C# type (class name) that is using tons of memory:

  1. Take the dump file generated in Step 1 and place it in the machine that has VS installed.
  2. Open Visual Studio
  3. Go to File>Open>File
  4. Open the Dump File
  5. This will open the Minidump File Summary
  6. On the Actions section of the report hit “Debug Managed Memory”
  7. This opens the Managed Memory report
  8. Sort the report by “Inclusive Size” descending
  9. The types at the top of the list are the ones using up all your memory

From here you are on your own. You need to understand what those types do and why they are using all the memory. On my particular situation, my IoC container was set up to use singletons on tons of WCF client classes. I registered those types as transcients in the container; that solved my problem.

Best Way to Store a Yakima Cargo Box in Your Garage

The Yakima Cargo Box I own is a RocketBox Pro 14. I used cables, pulleys, and a winch to hang it right on top of where I park my car. When I winch it down, it lands right on my car’s cross bars.


The box fits well on top of the opened garage door. You can see that and the winch on this pic:


On this pic you can see the pulleys and cables:


This final pic has the car right under the box:


This project was a lot of fun; it involved pulleys and a winch! I thought I’d share this in case someone’s looking for ideas.

EMF Meter Comparison (ED88T, ED78S, Trifield 100XE)

After searching for the right EMF meter for my home, I decided to buy the Cornet ED88T. On this post you will find why.

These are four types of EMFs that you want to measure in areas where you spend a significant amount of time:

  1. Microwave Radiation
    • Sources: wireless technology like Wi-Fi routers, cell towers, cordless phones and “smart” meters
  2. Magnetic Fields
    • Sources: power lines, improper home wiring and appliances
    • Health: They decrease the immune system and are known to be carcinogenic3
  3. Electric Fields
    • Sources: unshielded electrical wiring
    • Health: They rob you of a good night’s sleep3
  4. Dirty Electricity
    • DE are the frequencies that travel on your home wiring from things like solar power inverters, florescent lighting, dimmer switches and wireless “smart” meters)
EMF type Cornet ED88T Cornet ED78S Trifield 100XE
Microwave Radiation  Yes  Yes  Yes, but not accurate2
Magnetic Fields  Yes  Yes  Yes
Electric Fields   Yes, but the scale is not ideal1  No Yes, but the scale is not ideal2
Dirty Electricity  No  No  No

Once you have the ED88T, you can watch this video to learn how to use it and you’ll probably wonder what the safe maximums are for all the readings:

EMF type Safe Max3 Safe Max in Cornet ED88T screen readings
Microwave Radiation  100 (day) 10 (sleep) microWatts/squared meters (uW/m2)  0.1000(day), 0.0100 (sleep) miliWatts/squared meters (mW/m2)
Magnetic Fields 1.0 milliGauss (mG)  00.10 microTesla (uT)
Electric Fields  Less than 10 V/m  0010. V/M
Dirty Electricity 25-50 Graham-Stetzer Units

Here are some of the readings I’ve collected.

Building your own Annoy-a-tron with an ATtiny85

The annoy-a-tron is a little device that makes a small beep every X minutes. If you hide it well enough in a co-worker’s cube, it will drive him/her insane and will do almost anything to find it.

The annoy-a-tron is currently out of stock at ThinkGeek and I really wanted to prank someone at the office with it. So I did some research and decided to build one.

I decided to go with the ATtiny85 because I enjoy coding more than I do soldering. Instead of buying a 555 timer chip with resistors, capacitors, etc. like they are doing here, I just need to program the chip, wire up a battery and a speaker. I chose the ATtiny85 over the Arduino hardware because the ATtiny is cheaper and draws less power.

The final product looks like this:


And the software I put together makes a beep of customizeable tone frequency and length at random time intervals.

These are the parts you need to build the circuit:

The ATtiny85 is cheaper if you buy it in bigger quantities, I regret not buying more just so I can have different programs (different random intervals, tone, and tone length) loaded on the chips ready to go. SparkFun doesn’t have the best prices so look around if you will buy in bulk. I trust SparkFun and that’s why I bought most things there though.

You need a programming board to program the ATtiny85. I chose the Tiny AVS Programmer instead of the official one because I wanted to try out the Arduino IDE. To set up the IDE with the programmer, just follow the programmer’s hookup guide.

The Circuit:

The circuit is very straight forward. You just wire:

  • The positive end of the battery holder to the positive pin on the ATtiny85 (the solder tail).
  • The negative end of the battery holder to:
    • The negative pin on the ATtiny85
    • The negative pin on the piezo speaker
  • The chosen out pin (I chose pin 1) of the ATtiny85 to the positive end of the piezo speaker.


The Program:

I used the Arduino IDE (set up with the Tiny AVR Programmer Hookup guide) to program the ATtiny85.

Click this link to get the source code of program I loaded on the ATtiny85.

The program was deeply inspired by TinyTone to generate the tones and millionOhms to preserve power by getting the ATtiny85 to go to sleep.

I found that testing the program out takes a long time since you have to actually wait and see how the chip behaves. The program works like I want it to but I still have some questions that I’d like to ask an Arduino IDE (c++) expert or need a good amount of time to test out:

  • are the #include statements optional?
  • are the #define statements actually setting a variable or are they optional?

Testing those things would take time since removing them might not make compilation break but it might make the ATtiny85 not go to sleep properly and use more battery than expected. So I would have to see how long the battery lasts to really know if it is sleeping properly or measure the current being used by the ATtiny85 with an ampmeter.

Well, I hope you have fun with the ATtiny85! I’ve tried it with a couple of beta victims and I’m ready for a real one tomorrow.

Unlocking your Verizon phone

I currently own a Verizon HTC Incredible 2 cell phone.

I’m happy with Verizon (they’re the only ones that have good signal inside my house). But when I go outside the USA (I go to Guatemala often), I want to be able to switch the SIM card to one that works with a local mobile service providers. Otherwise I would have to use roaming with Verizon and that is ridiculously expensive.

I gave Verizon a call and they quickly gave me the  “unlock” code for me to enter in my phone. After entering the code, the phone was immediately unlocked! They only made me agree to a very obvious agreement that if I stick another SIM card in there I acknowledged that I was no longer using the Verizon service and Verizon could would not support me while I had that third party SIM card in my phone. But if I then switched back to my Verizon SIM card and ran my phone in CDMA (or Global) mode, I would be supported again.

And one more thing, Verizon uses CDMA. SIM cards are used for GSM. So I tried removing my Verizon SIM card from my phone and I was still able to get Verizon service. Nice to know.

I then stuck a SIM card from a friend that uses T-mobile and switched my Incredible’s mode to GSM, I could make and receive calls as him. Very cool.