How to sign Powershell scripts with self-signed certificates in Windows 10

I wanted to allow all signed Powershell scripts to run on a PC in our house on Windows 10. To do that, I needed a code-signing certificate.

Unfortunately, the days of easily obtaining a free code signing certificate seem to have ended. Have no fear! You can create a self-signed certificate if you don’t expect to use the certificate anywhere but on the PC where the certificate was created.

First, I enabled Powershell scripts to run. From an administrative Powershell command prompt:

> Set-ExecutionPolicy AllSigned

Acknowledge the warning and you’re ready to execute only signed scripts.

But, if you create your own script, you’ll need to sign it. To create the necessary code-signing certificate, you’ll again use Powershell. From an administrative Powershell command prompt:

PS C:\Dev>New-SelfSignedCertificate -CertStoreLocation Cert:\LocalMachine\ -Type CodeSigningCert -Subject "CN=PowershellScripts" -NotAfter (Get-Date).AddYears(10)

You can change the Common Name (CN) to anything you’d like, or adjust the expiration date (using -NotAfter). I’ve got the expiration as 10 years from today.

Once you’ve got the code signing certificate created as shown above, you’ll need to move the certificate to the Trusted Root Certification Authorities. If you don’t, when you sign the powershell script, it still won’t be allowed to run (and the act of signing will produce an UnknownError).

Start the certificate manager (press Windows key, type cert, and select “Manage computer certificates“, or hit Windows+R, then type: “certmgr.msc“).

Drag Certificate Into Trusted Root Certification Authorities

Expand Trusted Root Certification Authorities first, then expand Personal > Certificates and select the PowershellScripts Code Signing certificate and then drag it into the Trusted Certificates list as shown above (or you can right click, cut, and then paste it as well).

Now that you’ve got a trusted code signing cetificate, you can sign your Powershell scripts.

If you’ve only got one code signing certificate (which I presume you do otherwise you wouldn’t have needed a new one), from an administrative Powershell command prompt first switch directories to where the script you want to sign is located, then do these commands:

> $cert = (Get-ChildItem Cert:\LocalMachine\my -CodeSigningCert)[0]
> Set-AuthenticodeSignature .\reconnect-iscsi-targets.ps1 $cert

You should then see a table with the SignerCertificate, Status, and the Path. If everything went well, the Status should be Valid.

Here’s something interesting you can do with iSCSI targets and PowerShell using a signed PowerShell script.

 

 

Automatic Reconnection of iSCSI Targets in Windows 10 using PowerShell

When my highly recommended Synology Disk Station reboots for a required update (I’ve got it set to automatically reboot), a shared Windows 10 PC in our house cannot always successfully reconnect to the iSCSI targets without manual intervention. Unfortunately, I haven’t always noticed which has led to several features of Windows not functioning the way I want (I have mapped the iSCSI drives/disks via Windows and made them into network shares for the other PCs/laptops in our house — this way I can use Windows bitlocker encryption on the iSCSI drive contents).

To make the connection more automatic, I created a simple one line PowerShell script that periodically attempts to connect to any disconnected iSCSI targets using the Windows Task Scheduler.

I saved this into a script file called reconnect-iscsi-targets.ps1:

Get-IscsiTarget | where ($_.isConnected -eq $false) | Connect-IscsiTarget

Then, in the Task Scheduler, I created a new task set to run every 10 minutes daily. The script just gets all iSCSI targets, filters only those that aren’t connected, and then passes the results to the connection cmdlet.

For the action, I selected “Start a program” for program/script, I entered: “powershell.exe”, and then added the arguments “-File” and the full path to the file name, like:

-File c:\Users\aaron\Documents\reconnect-iscsi-targets.ps1

If there are spaces in the path to the PowerShell file, be sure to add quotes around the full path and file name.

You shouldn’t need the start in option set (leave it empty if you’d like).

On the General tab of the task, make sure you’ve set the “Run whether user is logged on or not” option and “Run with highest privileges.”

Next up — how to quickly create a Self-Signed Code-Signing certificate. And, how to actually allow scripts to run!

Frustrated by the DocumentDB Emulator

I was very excited about the announcement of a DocumentDB emulator!

I could finally explore the magic of this new document-based database (I can’t say “NoSQL” as it supports a SQL dialect) without spending money just to explore the database (it was a “pay to play”).

However, it’s not to be for me:

  1. Worst: It supports requests from LOCALHOST only. Its ports are bound to 127.0.0.1 rather than 0.0.0.0, thus preventing it from being usable from other machines. I wanted to install this on an always-on PC in our house rather than install it on my home workstation. I can sort of see why they want to limit it, but come-on, this is for development purposes. It’s not set up for availability, performance, etc. One simple right click of the app-tray icon resets and clears all the data. There are a number of effective ways for making it developer only — and I wouldn’t have picked this one.
  2. It has constantly used CPU, even when it’s not being used. On my laptop for example, it was hovering around 10-15% CPU, even when there were zero active connections. This problem isn’t consistent as I installed it on a secondary workstation and it’s using a lot of RAM (nearly 400MB), but only 1% CPU.
  3. It’s Windows only. This is actually a minor point if you’re using Windows, but if you want to use a Mac and do development, even with a VM hosted emulator, you won’t be able to.

So, for the best experience with DocumentDB, you’ll likely need to stick with the pay-to-play option of hosting it in Azure. I’m disappointed. I’ll look for a different database … something that doesn’t have this limitation.

Bummer.

Alternatives to Monopoly: Some table-top board games you should try

In the USA, there are some traditional board games that are commonly found in the closets of many households. The staple board games if you will.

Monopoly comes to mind for example. If you did a survey of 100 adults in the USA to name a board-game, I’d bet Monopoly would be number 1 on the list. Even McDonald’s for years has run various gaming promotions that involved the Monopoly brand. It’s ingrained in the culture. Let’s face it though: Monopoly isn’t for everyone. I think I enjoyed a game one time. But, I’m not sure we actually ever finished the game. Maybe that’s why I enjoyed it.

There may be a few games of Monopoly still underway since 1935 when it was released.

Once you get beyond Monopoly, there’s the Scrabbles, Clue, BattleshipRisk, and many more. We had many of those games in our home’s closet until recently. We looked at the stack of games, talked briefly, and donated them all to a local charity. They just don’t hold our interest anymore compared to the modern board game.

As a child I was playing Risk with a cousin …, he got so unhappy with his bad-luck and my good-luck that he threw his dice at me as hard as he could. I hadn’t know I’d be at Risk (!!! :) ) for playing that. There are better games than Risk as far as I’m concerned.

I played Axis and Allies (I think it was that edition) some in college and never got into it. My group of friends played it occasionally for a year or two; I played it very casually. I played more “speed Axis and Allies” and friends played, “give me 20-30 minutes to consider my actions as the WORLD IS AT STAKE HERE.”  That experience turned me off to board games for the most part for a long time.

It’s changed a lot in the last 10 years. There are thousands of great games in a wide variety of genre these days at all price points.

In this post, I’ve included a handful of games which my wife and I consider great transitional games for someone who has tried (and either liked or disliked) the old-traditional board games. I’ve seen some lists recently that contain a few games that I’d definitely not consider transitional or starter games, so I was motivated to build my own list.

Ticket to Ride, Europe

Ticket to Ride Europe, by Days of Wonder, with over 3 million copies sold, is for 2-5 players and works well with 2-4 (I’ve not tried with 5). Games usually take about one hour and a little longer if people are learning to play. It’s stand-alone and does not require a base set (be careful to note that some boxed Ticket to Ride games require a base set to play).

The essential part of the game is that you’re building a hand of cards that eventually can be converted into rail lines for points. Most points at the end wins. It’s learn-able in 5 minutes or so on average and usually takes players a few rounds of play before they’re comfortable with the rules in action.

For my USA based readers, you’ll see that there’s an edition of the United States and you might be inclined to buy that. Buy it if you’re playing with 4 people. But, if you’re playing with fewer people, I’d strongly suggest you try a smaller map, like Europe (as it’s stand-alone). You’ll find that it’s a more competitive game that way as you’ll be likely working to complete the same rail lines as the other players. Europe is great with 4 players.

There are many variations on Ticket to Ride that  you might want to try as well.

What’s great about it is that while you can see the progress of other players, and occasionally unknowingly hinder their progress, it’s not necessarily obvious who will win the game until the end. There’s a bit of mystery as there are special cards called Destination Tickets in this edition of the game that are kept secret until the end of the game and may dramatically affect the score of individual players.

Pandemic

pandemic

If you aren’t prepared for a game that takes a little longer to learn, Pandemic may not be a good transitional game. You should give this one a chance though.

Assuming you can get through the rules (which admittedly are more complex than those of Monopoly), you’ll enjoy this cooperative game with friends and family (ages 12+ probably is best). Nearly every game I’ve played has ended up as a close win or close loss. You often don’t know right until the end which leads to a lot of enthusiastic and sometimes overly dramatic play by the players (but that’s the fun!). As the pandemics spread across the map, it’s your job as a band of specialists to reduce the spread, find the cure, and possibly eradicate the diseases entirely. The reason that I suggest this game is that it’s a great cooperative game. Everyone MUST play together or YOU WILL LOSE. Most of the games I played as a child were “versus” or team games and so this game was an eye-opener for me. The game plays against us all?

You might choose to ignore the thousands of positive reviews and instead look at the 1-star reviews on Amazon. Don’t. I honestly believe the folks that gave up on the game simply did not give it a fair chance or wanted to not learn it. If after reading the instructions, it’s still not clear, find one of the hundreds of walk-through videos that exist online. Here’s one from the publisher. Here’s another from TableTop where they play through an episode.

Also, until you’re committed to this type of game, do not mistakenly buy Pandemic Legacy. Absolutely, it’s a FUN game; one that requires a commitment of at least 12 plays to finish the game. It’s best played by a group that is consistent from play to play (as it’s telling a story as it goes through so jumping in during the middle of the game won’t be as interesting or as engaging). I’ve only played through June so far, and having the back-story and experience of playing the early episodes is really what makes that game top notch.

Onami from Wyvern Gaming

onami

This is a great reasonably quick game (under 30 minutes). It’s really easy to learn and play. However, Strategy! As you take turns, you place numbered tiles on a grid. Each tile placed then may allow the player to mark one or more other tiles as their own. In the end, it’s the person with the most tiles that win. The challenge is that until the last turn is played, a tile may change owners many times. My wife and I were surprised by this board game that we picked up by chance at Gen Con 2016 in August. (Apparently, it had been a Kickstarter game).

But it direct from Wyvern here for $30.

Carcassonne

carcassonneI first played an Android tablet version of this game on a plane with a friend. I’d heard of the game but never played it (digitally or physically). While the rules at first were a bit strange, it only took a few rounds of play to understand the basics.

This is a tile laying game and ideally needs a large space in which to play as there’s not a traditional board like other games. Instead, you’re building the board as you play by laying tiles that represent various aspects of the French countryside. Games take between 30-45 minutes. It’s easy to learn for kids and adults. Make certain you’re not buying an expansion as there are a few.

It’s about $28 on Amazon.

Patchwork

patchwork

 

This is a two player game that takes about 20-30 minutes to play and maybe about 5 to learn. Essentially, you take turns choosing various pieces using your buttons (as money) to build the best high scoring quilt. It’s really easy to learn and play but is very strategic. In some ways, it’s like a dynamic Tetris as you try to fit pieces to your board, yet not everything will fit perfectly and in the end may cause you to lose the game! Some apparently have said it’s a puzzle game, but I don’t consider it puzzle-styled at all. It’s luck, strategy, and the skill of your opponent that determines whether you’ll win. (I dislike puzzle games and wouldn’t play it if it were puzzle-oriented).

It’s usually around $22 on Amazon.

Castle Panic

castlepanic

Castle Panic ($20), like Pandemic, is a co-operative game. Everyone wins or loses. The difference here is that there is a player that comes out ahead of the others by score (victory points are counted by how many monsters are slain). It’s considered a tower-defense game. That just means that the monsters are attacking the castle and that it’s your job as a player to defend the tower (castle). Each turn players try to eliminate or push back the various monsters that are making their way to the tower. This could definitely be played by younger kids if you don’t mind that they’re killing orcs and other monsters and that they can do a bit of strategy with their parents or family to think beyond just the current turn.

There are variations like Star Trek Panic ($32) that are also available (and slightly more expensive and have a few more rules that may be too challenging for younger kids).

One Hit Kill

onehitkill

Originally available via Kickstarter, One Hit Kill is easy to play and learn, and just as easy to lose.  We played this with some family earlier this year and they hated and loved it! There are a lot of ways to lose the game and only one way to win. Basically, you’re just trying to build a run of numerically sequenced cards (2,3,4,5 for example) in two different colors. The colors will need to match a special card. Once you’ve matched it, Win. The entire rules are explained on the page I linked above. It’s that easy.

It’s available direct via the publisher here.

10 Days in Africa

outofafrica

For two to four players, this quick game will challenge you to build a route between various countries in Africa. You’ll need to take a creative route that starts in one country and using land, water, and air travel plots a successful route to a final country. The rules and game play are simple. Plays in less than 30 minutes. My nine-year old nephew understood the game and the rules, but was stressed by the planning that was required (as he couldn’t see all of the options that might be available to him). So, consider it possibly better for slightly older children if they’re playing against older kids or adults.

Of course, there are other countries, like USA, Europe, Asia, and the Americas available. You may have to hunt around for a copy of any of them though which is disappointing.

And Many many more!

Don’t be afraid to look around. Amazon has literally tens of thousands of board game listings. Seriously.

Also, find your local board game store and stop by. HOWEVER, if you’ve never been to the board game store, make sure you call ahead or look at their website to confirm they have a variety of board game options. (Some cater to wargaming rather than board-gaming). My wife and I, when we visit a new city in the USA, always try to find a few local board game stores and stop in and buy a few small games to play on our vacation (and spread the board game love I guess a little). We’ve met some really interesting people doing that and gone to a few stores that were unique to say the least (one in particular where we developed a case of claustrophobia walking through the overly packed and stacked boxes and aisles. Two people couldn’t fit down an aisle and it felt like it was all going to tumble on our heads!).

You can also use the web site Board Game Geek.com, but for those new to board games, I’d suggest you stick to Amazon and your local stores. While it has a lot of great information, it’s often a bit intense for newcomers. :)

I had a few more games that I’d intended to add here, but now that I search for them on the Internet, I see that they’re no longer published and they’re all hard to obtain. While you might enjoy the challenge of spending hours tracking down a copy, I’d suggest you buy a different board game and play that instead. So, I’m not going to list them today.

Some of the best games tend to be available on Amazon and are well reviewed by hundreds and thousands of people.

(Next , I’ll create a post with some of the cooperative games that I’ve enjoyed playing with my wife and friends and family).

Comments and feedback welcome!

Geek gift ideas 2016

If you’re looking to buy yourself, I mean someone else some gifts for the upcoming holiday season, here are some items that I’ve found useful or handy around the house. It’s all stuff that I use and would recommend.

KMASHI 400A Peak 14.8V 800mAh Compact Car Jump Starter

It’s around $40. Our cars normally start without issue. Occasionally however, we’ve had a dead battery in an inopportune time or location and needed to call someone for a jump. Now, rather than carrying a giant jump battery in the car, we carry this.

More frequently, I use it to jump start our riding lawn tractor that often has a depleted battery (that I’ve not been able to successfully troubleshoot). I’ve had this for more than a year and used it more than 6 times without any trouble (thankfully, I haven’t needed it more than that). The convenience of it is awesome. It’s so small! Of course, it can also be used as just a USB charger. It charges with an included micro-USB cable.

Tripp Lite 1 Outlet Portable Surge Protector/Suppressor with Timer

Many Li-ion battery chargers for outdoor equipment do not recommend leaving the battery charging at all times. So, I bought this simple single outlet surge protector and timer combination from Tripp Lite.

It costs about $22. I plug a power strip into it and the chargers into the power strip and generally set it to 3 hours if I’ve used the battery powered equipment for very long. At the end of 3 hours, it automatically turns the power off (and to the entire strip) so I don’t need to worry about whether the batteries have charged too long.

Wago 221-413 LEVER-NUTS 3 Conductor Compact Connectors 50 PK

I didn’t know these existed until a year ago. While they’re a luxury item for sure, they make common electrical connections painless (for me at least). I’m sure some of you swear by the old traditional wire-nut. But, after I tried these, I’ll never go back. They make them in a few configurations that are worth looking into.

 

The price varies depending on what type you buy, but they average between 20 to 50 cents each.

I’ve used a lot of the 2 conductor version.

Bike Peddler Take A Look Cycling Eyeglass Mirror

Almost 1500 reviews on Amazon and nearly an average of 5 stars. These things are great. I’ve had one for 3+ years and if you wear glasses and ride a bike and haven’t liked whatever mirror option you currently use, … I love these. They’re simple and effective.

They’re around $12 usually (and you shouldn’t need to pay more than that).

Planet Bike Blinky “3H” 3-Led Rear Bicycle Light with Self Leveling Helmet Mount

PlanetBike Blinky 3H

Bike safety is very important to me. And it should be for you too. This novel little light attaches securely to the rear of your bike helmet and self levels so that it’s always pointing vertically in a reasonable direction. While you could attach it to your bike, there are better and brighter lights available for your bike that I’d recommend instead. Use this as a secondary bike light. It’s lightweight. I don’t notice its there. It’s about $20.

GMS Optical Premium Grade Comfortable Silicone Anti-slip Holder for Glasses, Ear Hook, Eyeglass Temple Tip


If you have sports glasses (I’ve got a pair of prescription Adidas sports glasses for example), you may have situations where you’d like to have a bit more confidence that your glasses aren’t going to hurtle off your face at some point due to unexpected motion, sweat, etc. I’d tried some of the bands that attach to glasses and found them distracting, especially when riding my bike (either too loose or too tight). These simple and inexpensive (around $6) holders give me the confidence to wear my glasses in situations where I was concerned about them falling off my face.

This was especially true while riding my bicycle. When I was looking down while riding (even for a moment to look at the GPS, etc.), I often had the distinct feeling that my glasses were sliding off my face. On hotter days, this was exacerbated by perspiration. No more! While I wouldn’t be brave (or dumb) enough to think that these would hold my glasses on while riding a loop on a modern roller-coaster, they perform well enough for more typical day-to-day sports. As you’ll see from their ratings, I’m not the only person that likes them.

They’re under $6.

Shacke Hidden Travel Belt Wallet w/ RFID Blocker

When traveling internationally, my wife and I always carry our passports on us while out and about (I know that some people leave them in the hotel room). I’ve tried a few different ways to carry my passport over the years, and this is my current favorite discrete carrying option. It’s lightweight and fits well in the front of one of your legs. Occasionally, you’ll notice it, but it’s not distracting. It’s got room for a few more things, but it’s not intended to carry everything; just stuff you don’t frequently need. I put spare cash, a paper map, and often our ATM card inside. Apparently, there were/are gray wallets of this, but unless you have a gray belt, it will show. By the way, this definitely requires that you wear a belt and is about $16.

Canon PowerShot G7 X Mark II (Black)

I’m sure many of you have decided that your phone takes great pictures and that’s all that you need. Fine. I accept that you’re missing out. OK, seriously. Your smart phone probably does take some great pictures. But, some images just can’t be captured by your smart phone. Occasionally, you’ll be able to walk closer to something you want to capture to emulate “zoom”, but often, you’ll find that the picture you captured isn’t the way you remembered it. This is where a nice point-and-shoot + more camera comes into play. I’ll take pictures when I’m on vacation with both this camera and my smart phone. I’m not going to bore you with a long list of features. That’s available on the web.

Here’s why I bought this model:

  • RAW mode + JPEG
  • Touch screen (tap to take a picture)
  • Size / weight
  • Pop-up flash
  • Good battery life (definitely buy spare batteries though)
  • Good bokeh (for a point-and-shoot)
  • 24-100mm zoom. Means I can take adjust zoom.
  • Can attach to my tripod (or mini-tripod) and my Really Right Stuff equipment
  • Easy to adjust f-stop/aperture, etc.

It’s by no means an inexpensive camera. However, I do not foresee any reason I’ll want or need to replace it any time soon. So, for now, I consider it a long term camera.

I would strongly recommend you buy a backup battery, regardless of the camera you choose. I bought some cheaper replacement batteries, not from Canon. I bought the DSTE NB-13L batteries. I bought 2 for 50% of the price of a Canon OEM battery. I’ll warn you, as does the camera when it detects these the first time, that these are not Canon batteries. You’ll need to acknowledge a warning that they are not Original Canon Batteries. They work fine though and I’ve not noticed any significant difference from the standard Canon batteries. They last a reasonable amount of time. Some combinations of extra batteries include an extra charger. Having lost a charger on my last trip to Finland, I was glad I’d brought a spare along.

Also, so that I could use a quick release plate with my Really Right Stuff tripod ballhead, I bought a quick release L plate from Desmond. (I usually buy from Really Right Stuff, but they didn’t have a great inexpensive option for this camera).

The model I bought fits the camera very well and is easy to attach and remove. It does make flipping the screen around more of a challenge, but I accept that limitation and rarely is it an issue (as I can always remove the L plate quickly).

SUNWAYFOTO Table Top Mini Aluminum Tripod T1A10 Tabletop Sunway

I attach my Really Right Stuff BH-25 Ballhead to this little tripod. It works really well.

It’s about $35 and fits nearly anywhere (from a small bag to a large pocket). I find a spot usually on a table, nature (like a rock), etc., snap the camera to it, and take a few pictures. It’s really handy and I take it on all trips where I take a camera other than my smart phone.

AmazonBasics Thermal Laminator


This $22 laminator is great. I had no idea how useful this would be. We bought it initially to protect a bunch of table-top board game cheat sheets we’d made or copied. We print them out on our inkjet on regular paper and then laminate them in a 3 mil thermal laminating pouch. The laminator takes 4-5 minutes to warm up at first so there’s no instant gratification that comes with it’s use. Once it heats though, you can feed sheets in with nearly wild abandon (there’s no reason to wait between sheets). In addition to the cheat sheets, we’ve protected copies of important travel and legal documents, copies of instructions (often that we want to hang near the equipment like our furnace or water filtration system). I’ve made small signs and placards for various events and even cleaning instructions for a few things around our house. The laminating pouches are often found in 3 and 5 mil. The 5 mil sheets are very thick and we don’t use them nearly as often.

I’ve also found that using our paper trimmer for items smaller than a full page works really well (rather than trying to cut with scissors). We’ve got something like this (although not this exact one as I can’t find the model we have). Just buy something with replacement blades in case they dull.

And, I just blogged about it a week ago, the Ecobee ecobee3 thermostat is also on my list.

Next time, I’ll post about some table top board games I’ve enjoyed recently.