Connecting to SSAS from Report Builder Query Designer – A Connection Cannot Be Made

Introduction

Recently I was attempting to create a dataset in the SQL Server Reporting Services Report Portal. I created my data source, then launched Report Builder to create my Dataset.

Report Builder connected to my SQL Server Analysis Services Tabular database OK, the Test Connection button worked, but when I tried to go into the query designer I kept getting the error:

A connection cannot be made. Ensure that the server is running.

I knew my server was running, I could connect to it and run queries from SSMS (SQL Server Management Studio). I found some solutions that suggested I change my SQL Server Browser service to log on using the Local System account. Tried it, didn’t work.

I found another solution recommending I add a firewall rule to allow inbound traffic on port 2383, but no love there either.

The Solution

It turned out it was all related to the way I’d formatted my data source connection string in the SSRS Report Portal. I had entered it as:

Data Source = acdev;initial catalog = WWI-SSAS-Tabular

When I used the Test Connection button in the Report Portal, it worked fine. It even let me connect when I launched Report Builder. But when I tried to launch the query designer in Report Builder, it gave me the aforementioned error:

A connection cannot be made. Ensure that the server is running.

I came upon my solution by launching Report Builder, and telling it I wanted a data source embedded in my report. On my first attempt I simply copied what you saw above from the Report Builder, and was faced with the same crushing disappointing result.

On the second try I used the Report Builder feature to actually build my connection string. Report Builder produced:

Data Source=acdev;Initial Catalog=WWI-SSAS-Tabular

And by golly, it worked! I was able to use the query builder to create a DAX query.

To be sure I was still sane, I went back to the Report Builder and replaced my connection string with the one above. Still in the Report Portal, I added a new Dataset which launched Report Builder.

I picked the Data Source I’d just updated in the Report Portal, and this time I was able to get into query builder, create a new query, and save it back to the server as a dataset.

Conclusion

I can only guess it was the extra spaces around the equal signs that were messing things up. I’d added the spaces thinking it made it a bit more readable. Readable, but as it turns out non-functional.

Some of you maybe going “you big dummy” at this point, and perhaps justifiably. I still think it’s odd though that the test connection buttons in multiple tools all worked, yet the query designer crashed.

Regardless, I’m happy I was finally able to find the solution. I’d spent almost five hours on this, so hopefully this will save you a little time and get you back to creating queries.

Sponsored Post Learn from the experts: Create a successful blog with our brand new courseThe WordPress.com Blog

WordPress.com is excited to announce our newest offering: a course just for beginning bloggers where you’ll learn everything you need to know about blogging from the most trusted experts in the industry. We have helped millions of blogs get up and running, we know what works, and we want you to to know everything we know. This course provides all the fundamental skills and inspiration you need to get your blog started, an interactive community forum, and content updated annually.

What is My COM Port?

Introduction

I’m a ham radio operator, and I recently gave a presentation to my local club on how to program your radio using software. To do this, we need to connect our radios using a USB cable.

Most of the radios use a concept called a VCP or Virtual COM Port. You install the VCP driver, then can connect your USB cable to your computer, plug the other end into the radio, and launch the software.

The software will want to know, what is the COM port number you are using. I have a variety of radios, and it seems each cable wants to use a different COM port, and every so often the cable will wind up using a different COM port than it did last time.

So how do you find out your COM port? Well it’s pretty easy if you know where to look.

Finding Your COM Port

The best place to find this is in the Windows Device Manager. Click on the magnifying glass next to the Start menu icon.

I have my Windows toolbar set to hide the search entry box, but some systems will have a text box right next to the search. Which ever way yours is configured, start to type “device manager” into the search.

You should see a pop up like you do in the image above when it finds the Device Manager application. Just click on it to run it.

Scroll down in Device Manager until you find the entry for “Ports (COM & LPT)“. Click the arrow beside it in order to expand the list, and you should now see the COM port for your cable, in this case COM10.

Note that your cable will need to be plugged in for the entry to appear.

Conclusion

There you go, I told you it was easy, the trick is knowing where to look.

While I did write this with my fellow amateur radio operators in mind, there are all kinds of devices that need to use a COM port to access them from your PC. Using this quick guide you can easily find where to look to get the right COM port number for your situation.

Solving “An error happened while reading data from the provider” When Connecting to SQL Server From Visual Studio 2019

Introduction

Recently I was working on a SQL Server Analysis Services Tabular project in Visual Studio 2019. In attempting to connect to a SQL Server database to import data, I got the following error.

An error happened while reading data from the provider: 'Could not load file or assembly 'System.EnterpriseServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. Either a required impersonation level was not provided, or the provided impersonation level is invalid. (Exception from HRESULT: 0x80070542)'

Let’s see the steps I went through to get to this point…

Reproducing the Error

Start by opening your SSAS Tabular project in Visual Studio 2019. In the Tabular Model Explorer, right click on Data Sources, then pick New Data Source.

In the Get Data window, pick Database, then “SQL Server database” and click Connect.

In the “SQL Server database” window, enter the name of the server, for example “localhost”. Click OK.

In the credential window, with the default of Windows credential, use Impersonate Account for the Impersonation Mode.

Enter your credentials and click OK.

You get a dialog titled “Unable to connect“.

You get this, despite knowing you’ve entered your credentials correctly. I actually found the solution in a PowerBI issue on Stack Overflow, they were having a similar problem.

The Solution

The solution, as it turned out, worked for both PowerBI and Visual Studio 2019. Simply run Visual Studio 2019 in administrator mode.

In the pic above, I have VS2019 in my toolbar. I right clicked on the icon, then in the menu right clicked on Visual Studio 2019. I then picked the Run as administrator option.

Following the steps in the Reproducing… section above I entered my credentials and clicked OK.

After clicking on OK, instead of the error I got an Encryption Support error, that it was unable to connect using an encrypted connection. I believe that was because, in my case, Visual Studio and SQL Server are both on the same box, in a development VM. As such, I’d not bothered with the overhead of setting up encrypted connection support in SQL Server. In this case I was OK with that so just clicked OK.

Now the Navigator window appeared, and I was able pick a database to import from.

Conclusion

I hope this simple fix works for you. I know I spent forever looking for an answer, and was lucky that trying the same solution that worked for PowerBI, running in admin mode, also worked for Visual Studio 2019.

Expanding The Size of a Hyper-V Virtual Disk

Introduction

There are tasks that we all do, but rarely. It’s helpful to have a reference to go back to.

Expanding the size of a Virtual Hard Disk, or VHDX file, is one of those. I use Hyper-V quite a bit to create virtual machines for testing, development, and the like. Every so often though I’ll underestimate the amount of space I’ll need for a machine.

As it turns out expanding the drive size isn’t terribly difficult, but there’s quite a few steps involved. This post will server as a reminder to myself, and hopefully guide others, in expanding the size of a VM drive.

I’ll break this into two parts. In the first half, we’ll see how to expand the drive within Hyper-V. This will expand the VHDX file to a new larger size.

In the second half, we’ll go into the Windows running in the VM to tell it to use the newly expanded space.

Expanding the Drive in Hyper-V

Begin by opening Hyper-V. In the Hyper-V manager, click on Edit Disk in the Actions.

This will open the Edit Virtual Hard Disk Wizard.

If this is the first time you’ve run the wizard, you’ll see a welcoming screen. If you see this, I’d suggest clicking on “Do not show this page again” and clicking Next.

Now use the Browse… button to locate the VHDX file you wish to modify. Once you’ve done that, click Next.

Now we’ll select the action, in this case we’ll pick the Expand option and click Next.

Now we’ll enter a new size for the drive. It shows the current size as 250 GB, so I’ve entered 500 so I can double the size. Obviously you’ll enter a size appropriate to your needs.

Once done, click Next.

On the final page of the wizard it shows what is about to happen. It lists the name of the VHDX file we’re working on, what the action is (Expand), and what the size will be of the new drive.

Just click Finish and the VHDX file will be updated.

Accessing The Expanded Space in Windows

In this example we’ll be using Windows 10 inside our Virtual Machine. Go ahead and start, then connect to your Windows 10 Virtual Machine.

If you go into File Explorer you’ll see something interesting.

Even though we expanded the VHDX to 500 GB, our virtual machine still thinks the C drive is 249 GB.

What we need to do is expand the already existing drive into the newly allocated space.

In the Windows 10 menu, go down to Windows Administrative Tools, then pick Computer Management.

The Computer Management window has a tree on the left. If the Storage tree is not expanded, do so and click on the Disk Management branch.

In the screen capture above, you can see the orange arrow is pointing to the existing C drive area. To the right of that a green arrow points to the newly added but still unallocated space.

Right click in the C: drive area, and in the menu that appears select Extend Volume…

The Extend Volume Wizard now appears, just click Next to proceed past the welcome screen.

By default the wizard will put the only unallocated partition in the selected area, but if you have more than one unallocated partition you can select a different one.

At the bottom, the “Total volume size will” show the total amount of space on the new drive, once the unallocated space has been added.

The next line shows the maximum space in the unallocated partition.

The final line allows you to select the total amount of space to pull from the unallocated area. By default it is set to the max space in the unallocated area, but if for some reason you want to save some of that you can lower the amount.

In this case I’ll take the default options and click Next.

You’ve now reached the final screen of the wizard, just click Finish to have it do its work.

The Computer Management window now shows the expanded C drive. You can now close the Computer Management window.

If you go back to the File Explorer and refresh it, your C drive will now show the new size.

Conclusion

In this article, we expanded the size of a Hyper-V virtual hard disk (VHDX) that hosted a Windows 10 installation. As you saw, it was pretty simple to do, but did require a few steps.

Hopefully you’ll find this useful in working with your Hyper-V machines.

Working From Home – Permanently

Introduction

When the current COVID crisis hit, there were a lot of posts and questions about working from home. But of late I’m seeing an interesting trend of posts on social media from people who have been working from home, but were just told they’ll be working from home permanently. They will never return to the office, at least that of their current employer.

These folks have been “getting by” with temporary setups. Using a laptop on the kitchen table, or on a desk in the corner of the bedroom. Now that they’ve been told this will be a permanent situation, they are looking for suggestions and advice on how to setup a permanent home work area.

As someone who has worked from home for the majority of the last decade, I thought I’d share a few tips and tricks. Granted some of these may seem obvious, but since the questions are being asked I’m hopeful at least one or two of my suggestions may help the new breed of work-from-home people.

Some of these suggestions involve tech, but some also involve your daily workflow. Let’s get started!

Multiple Monitors

One of the best things you can do is have more than one monitor. Now granted, I went a bit over the top having a rack with six monitors, as you can see above.

In my case I do a lot of video recording and editing for all of my Pluralsight courses. In the big 32 inch monitor at the bottom center I hold the content I’m recording. In the lower right I put my notes that pertain to what I’m recording. The left side gets my recording software.

In the upper left I put my audio editing software. Upper right gets my web browser so I can quickly look things up that may arise as I record. Finally the upper middle is for miscellaneous stuff.

Having six monitors has increased my workflow as I don’t have to cycle through applications, everything is right there where I can see it.

I admit, most people don’t need this setup. However I would suggest at least two monitors, or even better three, as an ideal work setup.

If your main machine is a laptop you should have at least one external monitor port. You can get more through either an external GPU box (if your laptop supports it) or one of the many USB-to-Video adapters on the market.

Most monitors support multiple inputs, and you can use buttons on the monitor to swap between inputs (in my case, multiple laptops).

As an alternative to multiple monitors, I’m also seeing people using a 4K TV. The 4K resolution amounts to having four 1920×1080 monitors in a square. Using software like the Windows PowerToys you can easily snap an application to one of the four areas, or you can use the full area when you want to.

Racking Your Laptops

I use multiple laptops, as I work in multiple environments. I have a Lenovo P51 on the bottom, in the middle is my Apple MacBook. On top is another Lenovo that I am running Linux Kubuntu KDE Neon on.

My laptops are stacked on a wire shelf that I got from my local big box store. I like the wire rack as it helps with air flow around the computers.

I really like these shelves, they are affordable, easy to configure, and hold a lot of weight. My home office doubles as my “ham shack” (amateur radio), here’s a shot of the back wall and a little bit of the side.

The wire racks on the back wall hold my antique radios as well as some of my “antique” or classic computers like my Commodore 128 or the older “egg bowl” Mac. To the right of the Mac are my modern ham radios.

I use zip ties to hold each tower together so it winds up being a solid unit. Just be sure to have good, sturdy tables that hold a lot of weight.

Get A Good Keyboard

You are on your computer all day, and most laptop keyboards are not that great. (Although I do love the keyboard on my Lenovo P51). Using a bad keyboard can lead to many health issues with your hands. In addition, if you have multiple monitors using an external keyboard makes it much easier.

This keyboard is part of the Logitech line which (although it’s a bit hard to tell from my mediocre pic) does have a slight curve to it making it more ergonomic.

The big thing for me is the ability to Bluetooth connect it to multiple computers. This is connected to the three laptops you saw in a previous pic. I can just use the 1, 2, and 3 keys to quickly swap between computers (I use the buttons on the monitors buttons to swap inputs between the three laptops).

As someone who has suffered from hand issues, I find a regular mouse painful to use after a while. For years I’ve been a fan of the Logitech trackballs. I was amazed at how quickly I became used to them.

Pictured is a Logitech MX Ergo, which unfortunately can only pair to two computers so I have another older model trackball for use with the third machine.

You may wonder about the scrap of a yellow post it note over two of the keys. I work in PowerShell within VSCode a lot, and frequently use the F5 and F8 keys. I’m also one of those people who likes to work with the lights on very low, and with my old eyes distinguishing between the function keys can be difficult.

Using the little scrap of post it notes can make it easy for me to find my often used F5/F8 keys.

Use A Good Headset

Do you participate in online calls (Zoom, Skype, etc.) all day? Then for crying out loud, get a good headset!

It drives me nuts to be in meetings with people who use the built in mic and speakers on their laptop. These are NOT quality, and often sound like the person is in the bottom of a barrel. A very echo-ey barrel.

The wired earbuds some people use are a little better, but not by much. The microphone is tiny and comes across as very “tinny” for lack of a better word.

My headset of choice is the HyperX Cloud Stinger Core Wireless. You can get them from both Best Buy and Amazon, for about $80 (US currency). They have two big advantages over other headsets.

First, they are wireless. Drives me nuts to have a wire I can easily get tangled up in. Plus, and I admit this is a duh moment, I’ve stood up multiple times with the old wired headsets forgetting about the wire and jerking the headset off my head.

Second, and more important, is the muting. To mute my microphone, all I have to do is lift the boom up. That’s it, no having to fumble for a button on the headset. Just lift it up, it’s muted, lower it back down and people can hear me. It makes calls so much easier, I can hear people clearly, and they have clear audio of me.

They are so good I use them on a weekly Minecraft stream my friend Marc runs on YouTube. (I participate as ArcaneMining).

I will add, for recording my Pluralsight videos I use a Yeti podcaster microphone on a large boom arm. It gives excellent quality, however that is very much overkill (unless of course you are also recording Pluralsight videos).

Trust me, you will have a much better experience and the people you meet with will thank you. Plus they are at a price point that makes them affordable to most people.

Along with the headset also consider an external camera. While most laptop cameras are decent, I really get tired of looking up people’s noses during a call. You can place it on top of your external monitor for a much better view.

I’m fond of my Logitech C922, runs about $100 on Amazon, but there are many similar cameras of good quality.

Isolate Yourself

Now we’ll shift from tech to workflow related items. The first of these is to isolate yourself.

If you live alone this is easy, but if you have a bunch of people in your house it can be important to find a place you can isolate and have quiet time to think. Put your home office in a place where you can close the door, and make it understood when the door is closed to consider it a “do not disturb” sign.

I can understand there will be situations where you can’t isolate all day. But try to find set times where it’s clear to others in your household that you should be left alone. When the door is open, they are free to come in.

Not only will this make you more productive, but it will avoid embarrassing situations like a kid running through the background of a Zoom call in only their underwear.

Move

It’s important you take breaks through the day to move. To get up from your desk and walk around. I know personally I will get so focused on what I’m doing that time flies by, then I realize three hours have flown by without me moving from my chair. When I finally stand up, well my creaky old man body reminds me.

Use some kind of app or device to remind you on a regular basis to move. My Apple Watch will buzz every hour reminding me to stand up, and will even track how often I actually do it.

There are also apps for the various brands of smart phones, plus I’d imagine many freeware apps for your computer. If nothing else get a good old fashioned timer from the kitchen section of your favorite big box store.

Another advantage to the wireless headphones I mentioned earlier in this post is the ability to get up and move during an audio call.

Have Laptop Will Travel

An advantage of having a laptop for your main computer is it’s (surprise) portable!

Finding time to work at alternate locations can help keep work enjoyable. Perhaps once a week, take your laptop down to your local coffee shop (assuming it’s open), sit and work there with a cup of coffee for a bit. (Hint, good earbuds and music on your phone can help drown out the other noisy patrons.)

Go outside! I often carry my laptop onto my back porch to enjoy fresh air and sunshine while I work. There’s also a nice park nearby, I sometimes work from there using my phone as a Wi-Fi hotspot.

Don’t think you need to stay all day. Sometimes just two or three hours can be energizing and very productive.

Of course this assumes you aren’t doing a meeting, but most of us have time in the day or week with no meetings scheduled.

And because you are the go doesn’t mean you have to give up multiple monitors. If you have an iPad, and a modern MacBook the sidecar feature will let you use the iPad as a second monitor.

If you are on Windows, or an older MacBook, there is a nice piece of software called Duet Display that will let you connect your iPad to your computer (via the USB cable) and use it as an external monitor.

If your tablet is Android based, Splashtop offers a free piece of software called Wired XDisplay for both Windows and Mac that enables your Android tablet as an external display.

Set Boundaries

Of all the pieces of advice I can offer, this by far is the most important.

First, set boundaries with others in your household. Make it clear when you are working from home, you are WORKING. Just because you are at the house doesn’t mean you can “go ahead and do some laundry”, cut the grass, dust, make dinner, or any of the other typical household chores.

This goes for you, as well. When you work, focus on your work. When you are not working is the time for the other chores.

It’s also important to set boundaries with coworkers. Make sure they understand when you are available for meetings and when you shouldn’t be disturbed. Use your company work calendar to indicate when you are available for meetings.

They also need to understand you can’t just hop up on a moments notice to come into the office for “a quick meeting”.

Don’t be afraid to say NO! Push back for phone / online meetings. I used to work for a company that let us work from home two days a week. Even though I had it on my work calendar I was constantly having project managers schedule two hour “in person” meetings on my work from home days.

I finally started pushing back, saying I wouldn’t be in the office that day but give me a conference call line and I’d be on the call. Of course they’d say “we really want you here”.

I’d then ask “what value is provided from me being there versus on the phone”? “How will the meeting be different or less productive if I’m on a call?”

If they couldn’t provide a good answer, a really good answer, I’d tell them I’ll be there on the phone call talk to ya then. (Of course I also had a great boss who supported me, you may not be so lucky.)

Finally, set boundaries with your time. Designate the hours you will work each day. When you are working, make it clear to your family you aren’t available to do household tasks.

When it’s outside work hours, make it clear to your coworkers you are off. It is far too easy to wind up working far more hours than you normally would when working in an office. When (for example) 5 pm hits get up and walk away from your computer, and don’t go back until the next morning.

Conclusion

In this post I’ve shared some tips for people who are moving to a work from home situation based on my years of experience doing just that. I really love working from home, and I think you will as well if you setup a comfortable environment, with the right equipment, and having set boundaries with your family and co-workers.

Formatting A Drive as exFAT on Windows, macOS and Linux

Introduction

In my previous blog post, Sharing a Drive Between Windows, macOS and Linux, I described how to setup the three operating systems to read a drive that had been formatted as exFAT. The exFAT format is readable by all three, and making it easy to share files between different operating systems.

A natural question that follows is, “how do I format a drive as exFAT?”

In this article I’ll show how to format an external drive as exFAT. I’ll be using an 8gb thumb drive, but I’ve used this technique with both thumb drives as well as the larger external multi-terabyte hard drives.

Windows

Windows is the easiest of the three to format a drive for exFAT. First, insert the drive into a USB port. This will typically open the Windows File Explorer, but if not, open it.

Now right click on the drive letter for the USB drive, and click on Format. The format dialog will appear.

In the second drop down you can pick the file system. Use it to select exFAT. You can also enter a new volume label if you want. Simply click the Start button to kick off the format process.

You will of course get a warning that all the data on the drive will be lost, simply click on OK to proceed.

Once done Windows will let you know. Just click OK and your drive is ready to use.

Apple macOS

There’s a few more steps to formatting a drive to exFAT in macOS, but it’s still pretty simple. Start by opening Finder, then go to the Applications. In Applications, open the Utilities folder.

Inside the Utilities, launch the Disk Utility. If you’ve not done so, connect the USB drive you want to format as exFAT.

On the left side of the Disk Utility is a list of drives, click on the USB drive in the list.

Above the drive info area are a series of command buttons. Click on the Erase button. Note you need to click on the icon, not the Erase label.

In the dialog that appears, you can change the label if you wish. The important box is the Format one. You can use the blue arrow to bring up the list, and change it to exFAT.

Once exFAT is selected, you can click the Erase button on the lower right.

Once done, macOS will let you know. Just click Done, and the drive will be ready for you to use.

I’ve used this technique with macOS versions from High Sierra onward.

Linux

For this section, I’m using screen shots from my Kubuntu 20.10 computer. The techniques will work with most Ubuntu/Debian based installs. To make it more portable to other versions, we’ll do most of it using the command line.

Note, these instructions assume you’ve already followed the instructions in my previous blog post, and installed the exFAT utilities.

Start by opening up a terminal window, and entering the following command:

df

Your output will look something like this:

Filesystem     1K-blocks     Used Available Use% Mounted on
tmpfs             805596     1752    803844   1% /run
/dev/sda2      244568380 18388480 213686844   8% /
tmpfs            4027972      128   4027844   1% /dev/shm
tmpfs               5120        4      5116   1% /run/lock
tmpfs               4096        0      4096   0% /sys/fs/cgroup
/dev/sda1         523248     7984    515264   2% /boot/efi
tmpfs             805592      108    805484   1% /run/user/1000
/dev/sdb1        7815648       96   7815552   1% /media/arcanecode/4ECB-E340

For this exercise, I’ll be using the /dev/sdb1 drive which is my 8gb thumb drive.

Before we can proceed, we’ll have to unmount the drive. The command is simple.

sudo umount /dev/sdb1

Now that the drive has been unmounted, we can format it using the mkfs utility.

sudo mkfs.exfat /dev/sdb1

Once formatting is complete, we can check its status using the fsck command.

sudo fsck /dev/sdb1

Your output will vary depending on the drive you formatted, but it will resemble something like this:

fsck from util-linux 2.36
exfatfsck 1.3.0
Checking file system on /dev/sdb1.
File system version           1.0
Sector size                 512 bytes
Cluster size                 32 KB
Volume size                7633 MB
Used space                 3041 KB
Available space            7631 MB
Totally 1 directories and 3 files.
File system checking finished. No errors found.

A benefit of using fsck is that will also remount the drive for you, making it ready to use.

You can verify it again using your systems file explorer. Here I’m using Dolphin, the explorer built into Kubuntu.

Navigate to the drive, right click on it, and pick Properties.

In the properties window it will show you the file system. As you can see, it has been formatted to exFAT.

Conclusion

In this post we saw how to format a drive for exFAT on three operating systems. You can now format a drive using any of the OS’s, and be able to use it across all of them.

Sharing a Drive Between Windows, macOS and Linux

I have a lot of computers, on which I use a variety of operating systems. Some run Windows 10, my Apple macBooks all run macOS, and on others I have a variety of Linux distros, primarily Ubuntu based.

I would like the ability to share external drives, such as thumb drives or external SSD drives, between them. To get that compatibility across OS’s, I need to format those drives in a file format called exFAT.

exFAT is a replacement for the older FAT32, but has the benefits of other file systems such as NTFS. I can have long file names, and store files bigger than four gigabytes in size to name a few.

Windows and macOS both support exFAT out of the box. I can just plug in an exFAT drive into them, and both will let me read and write to them. (Note that not all drives come formatted as exFAT, you may need to reformat them to the exFAT system). Linux, however is another story.

To allow Linux to read an exFAT drive you need to install the exfat-utils utility. On Ubuntu based distros it’s pretty easy, just open up a terminal and enter the following command, all on one line.

sudo apt-get install exfat-fuse exfat-utils

For other distros you can use their native installer, such as yum, to install the exfat-utils. After that you can simply plug an exFAT thumb drive or SSD into your Linux box and it will know how to read and write to the drive.

Tips for the Disorganized Laptop Traveler

Introduction

I realize with the current (as of the time I write this) COVID lockdown, people aren’t doing a lot of traveling. But things are beginning to open back up, and will continue to do so as the year progresses.

In a former job I traveled a LOT. In addition I frequented user groups and conferences, giving presentations. Over time I’ve picked up a few handy, and inexpensive tips and tricks for keeping your laptop bag organized. So I thought I’d do a bit something different with this post and share some of these tips with you.

Keeping It Together

I have a lot of laptops, I admit I’m a bit of a gear nerd. Most folks though, have at least one, along with a tablet of some type, plus various accessories. How do you keep the power supplies plus all the associated cords neat and together?

I use pencil bags available in my local big box store in the school supply area.

These bags are inexpensive, typically around $3, come in a variety of colors, and hold a lot. Each laptop I have has a bag associated with it, which holds the power supply plus any extra cables I use with it.

As you can see, this is the (after market) power brick for my Dell Inspiron, along with two USB cables (one Apple and one Micro-USB) that I often need with that computer. When I’m ready to go somewhere, I just reach into a box and grab the bag for the laptop I’m taking with me.

In addition, we all seem to have lots of spare cables. I’ve used these bags to organize my cables, one for Micro-USB, another for USB-C, and so on.

What’s In The Bag?

So how do I remember what’s in each bag? Well at first I bought the book “How To Be a Psychic for Fun and Profit”, so I could use my magical abilities to just discern what was in each pouch. But the book didn’t make much sense, until I realized what’d I had actually bought was “How to Be Psychotic for Fun and Profit”. So I abandoned that and went with an alternate solution.

I purchased small tags, these are typically sold as tags for keys. You’ll find them in the office supply section of stores. On each tag I write what’s in the bag, making it easy to identify.

They are inexpensive, so if I decide to reuse a bag for something else I can take off the tag, throw it away and put on a new one. They can also be used to identify other devices.

Here I’ve attached one to each of my USB keys, to let me quickly identify the size. For other keys in my collection I might also write down what’s on there, for example “Backup for XYZ Project”.

It Just Needs More Power

One of the first things I do after I get a new laptop is hop on Amazon or swing by my used computer store and purchase spare power supplies for my laptop. This lets me keep one on my desk, one in a bag, and sometimes I’ll get one more to put by my recliner.

When I get a power supply, I use a Sharpie to write which laptop the power supply goes with.

Now I don’t have to think about which laptop this supply goes with.

It’s gotten a bit easier these days as many laptops are now powered with USB-C. This makes it much easier to share supplies. Earlier I showed the power supply I travel with for my Dell Inspiron. I actually have two of these, one for my Dell, and a second for my 2017 Apple MacBook.

This model provides 87 Watts to the laptop, plenty to power not just the laptop but any accessories I want to plug into the laptop like a USB monitor, hard drives, and the like.

In addition this power supply also has four USB A ports which I can use to recharge my iPads, Android tablets, iPhone, etc. This is especially nice in places like coffee shops or hotels where plugs may be limited.

Power To The People

Another thing I do to help address the problem of limited plugs is carry a small extension cord.

These are two I had handy. One is setup for devices with three prongs, the other two, I pick the one to use depending on what equipment I’m bringing with me.

Both are 9 feet long, which may seem a bit excessive but I have learned from experience wall plugs are not always where they are convenient. I can’t tell you the number of hotel rooms I’ve been in where the desk was no where close to the plug.

There may also be competition for an available plug. The small coffee shop I frequent has very few plugs. I’ve found I can make new friends by using an extension cord and offering to share it.

Hold It Together

In order to manage the mess of wires that accompanies any electronic device, I use Velcro cable ties.

These things are great. EVERY cord that comes into my house gets one. As you would expect, all my cables, laptop power cords, etc get these.

But I also put them on the power cords for my TV, lamps, power tools, fans, all my ham radio gear, you name it if it’s a cord it gets one of these straps.

Rising to the Occasion

Hand issues seem to run rampant in the tech community, being on a keyboard all day can take a toll. Something you can do to help your hands is get a laptop riser.

These are two different types I have, but there are many others you can pick from. On the left is a pair of wedges, they seem similar to door stops. They are nice because you can spread them out for any size laptop, and raise the laptop to different heights.

On the right is a riser that folds up nice and small, but the legs can extend out for whatever size you want. The L shapes on the front (closest to the lower edge of the photo) keep the laptop from sliding off. Note, if you have an extremely thin laptop your wrists may brush against the tops of the Ls.

Either way, it can raise your keyboard up and make it much more comfortable and ergonomic for typing, especially for long periods of time.

Which End is Up?

Cables ends like USB-C or Apple’s lightning are a real blessing as you don’t have to figure out which end is up. Micro-USB however, is another story.

As I’m sure you are aware, Micro-USB has one edge longer than the other. As I’ve aged, with my poor old eyes it can be hard for me to tell which side is the longer one, especially in dim light. I’ve come up with a simple solution though.

I’ve taken a silver Sharpie marker, and drawn a line on the side of the cable that corresponds to the long side of the connector. For white cables, I use a black Sharpie.

For the devices I plug into, I draw a corresponding line where the long side plugs into.

Here you can see I’ve drawn a black line by the port where the long side of the Micro-USB goes. This makes it extremely easy to plug my Micro-USB cables into the various devices I use, I just align the two lines and away I go, quick and easy.

You could also decide to draw the line on the short side of the Micro-USB connector, rather than the long side. Just be consistent once you make the choice.

In addition to silver and black, I’ve found the orange and red Sharpie markers work pretty well too.

I’m a Big Fan

One last piece of gear I keep in my bag is a small fan.

This fan has a battery and can be recharged over Micro-USB. As a matter of fact the previous photo is the back of this fan.

I can’t tell you how many stuffy conference rooms I’ve been stuck in. At my local coffee shop, sometimes sitting in front of the window can get really hot when the afternoon sun starts coming in. Even a small fan like this can make a huge difference.

This fan is small, about the size of my hand (although I admit I’ve got big hands). I like this model, it has three speeds and can run even when the battery is being recharged.

These fans come in a variety of sizes, shapes, and prices, so pick one that fits your budget and laptop bag.

Conclusion

In this article I’ve laid out a few tips that I hope will make your life a bit easier, and help get your tech gear organized.

If you have tips and tricks you want to share do so in the comments below, or let me know if you’d like to see more blog posts like these.

Having Multiple Entries for the Same PC in Microsoft Remote Desktop Application on Apple macOS

Introduction

In a previous blog post, Using the Microsoft Remote Desktop Application on Apple macOS, I showed how easy it was to remote control a Windows computer from your Mac.

One question I get asked is “Can I have multiple entries for the same computer?” The answer is yes!

This, of course, leads to another question, “Why would you want to?”

Reasons for Multiple Entries

There are a number of valid reasons for wanting multiple entries in Remote Desktop to the same computer. Let’s cover a couple by using examples.

First, let’s say you have a Windows 10 computer in the family room where your child plays games and does school work. Wisely you have setup their account as a “standard user”.

You have an account as well, as an administrator, to handle administrative tasks such as installing software, making sure updates are being processed and the like.

You could setup entries in Microsoft Remote Desktop, one for each user that logs into the computer. This allows you to have one entry to login as yourself, and a second to login using your offspring’s ID.

Now when your child comes to ask you to install the latest updates to Minecraft on the family computer, you can simply remote to it from your Mac using their ID, and install the updates providing your admin user ID and password. You’ll also have the entry to login as yourself, so you can apply updates and do maintenance.

For the second reason, you may wish to access your remote PC with different sets of option. In the blog post I mentioned earlier, I set it up to use all the monitors on my Mac.

Every so often though, I want to have my remote Windows computer running in a window. This allows me to see something on my remote machine, while still having my macOS desktop available.

One example, in my previous post I showed how to configure Windows to allow for remote access. I did so by having the Windows machine in a window on my Mac on one monitor, while creating the post in Safari on my macBook on a second monitor. This let me have them side by side, making it easy to create the instructions.

Rather than having to change the settings each time, I have two entries for my main Windows computer. The first, which you saw created in the first blog post in this series, opens the Windows machine using all monitors. The second opens it up in just a window.

Those are just two reasons, I’m sure you’ll be able to come up with many more.

Adding a Second Entry for the Windows PC

First, I’m going to assume you’ve already read my first article, Using the Microsoft Remote Desktop Application on Apple macOS. If you haven’t, please take a moment now to do so.

With Microsoft Remote Desktop open on your Mac, click the + button at the top, then pick Add PC in the drop down.

Note that for security reasons, in the screen shots I’ve replaced with the actual name of my computer with <name>.

Start with the name of the computer in the PC name, and pick the user account to login in as, or leave it as “Ask when required“.

Now we want to use the Friendly name to indicate not just the computer name, but also how this is used. For this example I’m going to have my remote machine display in a window, so I’ve entered <name> in a Window.

Next we’ll need to configure it to show up in a window, so click on the Display tab.

Here I will uncheck the default of Start session in a full screen, then check on Fit session to window.

Then, at the bottom I checked on Update the session resolution on resize. This way when I resize the window on my Mac, it will resize the computer I’m remoting into so the desktop will fit the window.

You can change the Devices & Audio and Folders if you wish. Since I’ve already covered those in the first article I’ll just click on the Add button.

Update the Existing Connection

Before we open the new connection, we should update the friendly name of the existing one to make it clear what the difference is. To do so, click on the pencil icon in the upper right of the connection created in the first article.

Go to the Friendly name field, and enter the name of the computer followed by (for this situation) All Monitors, then click Save.

Below you can see it now reads <name> All Monitors, and beside it the new entry we just added for <name> in a Window.

It’s now very easy to tell the difference in the two connections.

Launching the New Connection

Let’s now launch the new connection by double clicking on it.

Here you can see a new window appears on my Mac, showing my Windows desktop. (Note that you can see a bigger version of any of the images in my blog posts by double clicking on it).

You can see the window with the full Windows 10 desktop, including the Windows task bar. You can also see the macOS toolbar across the bottom, as well as the Mac menu bar at the top.

You can also resize the window. If you checked the Update the session resolution on resize option, the resizing the window will also resize the Windows desktop as you see below.

You can see my Windows 10 desktop now fits nicely into my resized window.

Please note you can only have one connection to a computer active at a time. If I am in the windowed version of my connection, then go back to the Microsoft Remote Desktop connection window and double click on the <name> All Monitors, it will disconnect the <name> in a Window session then launch the all monitors version.

Any time you launch a connection, it will disconnect any existing connection, if there is one, in favor of the newly launched one.

Conclusion

In this article we showed how to create multiple connections to the same computer in the Microsoft Remote Desktop application on macOS. This works with Big Sur as well as previous versions of macOS.

We also covered various reasons why you might wish to create multiple connections within Remote Desktop.

Armed with this information you can now create multiple connections to the same computer to fit the ways in which you want to use the remote computer.

Supressing “The certificate Couldn’t Be Verified” message Using the Microsoft Remote Desktop Application on Apple macOS

Introduction

In my previous blog post, Using the Microsoft Remote Desktop Application on Apple MacOS, I showed how easy it is to connect to one of your Windows computers from your Mac.

I frequently use the Microsoft Remote Desktop application on my Apple MacBook Pro to connect to one of my Windows computers. It presents a nice interface that’s easy to use and setup.

Once you’ve added your computer to the Microsoft Remote Desktop application (you’ll find the instructions in my previous post), all you have to do is double click on it to access your remote computer.

Here is the launching point, note that for security reasons in all of the images in this article I’ve blurred out the name of my computer and replaced it with <name>.

There is one irritating behavior. When connecting to a computer it frequently displays the following message: “You are connecting to the RDP host <name>. The certificate couldn’t be verified back to a root certificate. Your connection may not be secure. Do you want to continue?

Having to stop every time and click Continue is really annoying. Especially if you are on your home network, connecting to a computer you own and trust. There’s an easy fix though!

Suppressing the Warning Message

Simply click the Show Certificate button to display the certificate information.

Once you review, simply put a check mark in the “Always trust...” checkbox (pointed to by the arrow) then click Continue.

Since you are changing the trust certificates for your MacBook (or other Apple Mac computer, like the Mac Mini), macOS will prompt you to enter your admin password. Do so, then continue.

From here on out, all you need to do to connect to your remote computer is double click on it, and (if you’ve not saved it within the remote desktop program) enter your credentials. No more having to click to continue past the “certificate couldn’t be verified” message.

Conclusion

I’ll wrap this up with two quick notes. First, this works on the last several versions of macOS including Big Sur.

Second, while I’ve used Windows as the example, this will work with any OS (such as various Linux distros) that support RDP (Remote Desktop Protocol). Sadly, macOS does not support RDP so you cannot connect to another Mac from the Microsoft Remote Desktop application.

Using the Microsoft Remote Desktop Application on Apple macOS

Introduction

I use many computers in my daily life, including Windows, Apple Mac’s, and Linux computers running a variety of distros. It’s very convenient for me to be able to remote into another computer from whichever computer I happen to be on.

On my MacBook (although this would work on any Apple machine running macOS, such as a Mac Mini), the Microsoft Remote Desktop application is a fantastic program for remoting to another computer.

While primarily designed for accessing a Windows machine, it will work with most computers that support the RDP (Remote Desktop Protocol) such as many Linux distros.

Note that it will not let you connect to another Apple Mac, as macOS does not support the Remote Desktop Protocol. You can go from a Mac to Windows (or some Linux) computers using the Remote Desktop application, but not to another Mac.

Microsoft Remote Desktop is free, and in the Apple App Store. Just do a search for Microsoft Remote Desktop, get and install it. But don’t open it quite yet, as we have to configure the computer you are going to connect to.

Configure Your Windows Computer

I’m going to assume you are connecting to a Windows 10 Pro computer. Click on the Start button, the pick Settings. In the Windows Settings, pick System.

On the System page, scroll down in the menu on the left and click on Remote Desktop. (You can click on the image below, or any of the ones in this article, to see them in their full resolution).

You’ll first need to toggle on the Enable Remote Desktop setting, as I’ve done here.

Next, look under “How to connect to this PC”. This has the name you need to enter into the Microsoft Remote Desktop app. In this image it shows <name>, but for you it will show the name of the computer. Note that for security reasons, I’ve replaced the actual name of my computers with simply <name> in the screen captures.

Finally, at the bottom look at the User accounts section. By default, if you are an administer on the computer, you are automatically able to remote to the computer.

If you want a standard user, in other words a non-admin user, to be able to remote in you’ll need to add them using the “Select users that can remotely access this PC” link.

At this point you’ve now setup your Windows computer to be remoted into. Note you only have to do this once on this computer, after that it can be remoted to from other computers.

Adding a PC to Microsoft Remote Desktop on your Mac

Now return to your Mac. Assuming you’ve installed the Microsoft Remote Desktop application, open it.

The first time in, you’ll see the big “Add PC” button right in the middle. After you’ve added the first machine, using the instructions here, you can add more computers using the plus button (pointed at by the big red arrow) and pick “Add PC” in the menu.

You’ll then be shown the Add PC window. Start by entering the name of the computer you want to connect to.

After entering the computers name, you’ll see the User account line, which by default is set to Ask when required. In this mode you will be prompted for your login credentials every time.

As an alternative, you can save your credentials by picking Add User Account… in the User account drop down. You’ll then be prompted for your Username and Password. You can also create a “friendly name” for the account.

For example, if you were setting up a connection to your wife’s computer, you’d have to give her full user name, perhaps it’s her e-mail address. In the friendly name could just enter “She who must be obeyed’s computer”.

One nice thing Microsoft Remote Desktop does is save your credentials. Then when you add more computers that use these same credentials you can just pick it from the User account drop down and not have to recreate them every time. This is especially nice for when you use your same Microsoft credential to login to multiple Windows computer.

Once you add the user account, or leave it at the default to ask each time, you’re ready to look at some of the options in Remote Desktop. It’s worth your time to understand these, as it will affect your experience when working with remote computers.

Friendly name can be helpful if the computer has a cryptic name. Often when a PC is purchased the default name is something like WINRPXM457JB. Most home users don’t realize they can rename their computer and leave it at the default. Using the friendly name you can enter “She who must be obeyed’s computer” and know what machine it is.

I find this even more helpful in work environments where they use naming conventions like “HR-PC-001”, “HR-PC-002”, etc. You could instead use meaningful names like “Anna’s computer”, “Jack’s computer”, or “The nice lady who brings us donuts computer”.

If you have a lot of computers you connect to, you may want to group them. By default, there’s one group “Saved PCs”. You may want to create groups such as “My computers”, “Wife’s computers”, “Kid’s computers” and so on. This is totally optional, but the more computers you need to work with the more useful it will become.

The Gateway option is used in corporate environments that have setup Remote Desktop Gateway servers. Since this article is geared toward home users, it shouldn’t affect you. If you are in a corporate environment and need to remote in, your friendly neighborhood system administrator will be able to tell you if you need a gateway, and if so what do you need to enter here.

The other options are pretty straight forward, so let’s click on the Display tab.

Display Options

Here you have some choices on how the remote machine is displayed on your Mac. One notable one is “Use all monitors“. If your Mac has multiple monitors connected to it, you may want to have the remote computer displayed on all of them. To do so, check this box. If you do some of the other options become disabled.

Alternatively, you may want the remote computer only on one monitor so you can still access your Apple computer on the other monitors. Leaving this unchecked allows this.

If you don’t select Use all monitors, you then have the choice to start the remote session in full screen, or show it in a window.

Next up are quality settings, such as the color depth or optimizing for Retina displays. Note that the higher settings you pick, the more bandwidth and processing power it will take.

In my selection, shown above, I chose to use all monitors at a high quality. Make your own selections then click on the Devices & Audio tab.

Devices & Audio Options

This tab controls what gets shared between the host computer, your Mac, and the remote computer (typically a Windows computer).

If, for example, you started a video playing on your remote computer, the “Play sound” option controls where you hear the audio. The default, On this computer simply means the Mac running Microsoft Remote Desktop.

I generally go with the default options, shown here, then go to the Folders tab.

Folder Options

Using the folders tab, you gain the ability to transfer files between your Mac and the computer you are remote controlling.

Start by checking the “Redirect folders” option. Then in the lower left click the + button. In the dialog that pops up, select one of the folders on your Mac. After you’ve connected to your remote computer, this will show up as a folder in your remote computer. Here’s what it looks like on Windows, after you have remoted in.

You’ll see the name of the folder you picked, in this example the Documents folder, the text on my, then the name of your Mac, in this case represented by <my mac>.

From here you can double click to open the Mac’s folder in File Explorer, and begin copying files back and forth. Do note there is a “Read Only” checkbox in the Add PC dialog’s folder options. If you check it, on the Windows computer you connect to will be able to read and copy files from the Mac, but will not be able to copy files to the Mac.

Using redirect folders is optional, and only needed if you wish to move files between the two computers. To be honest, I seldom use this option as I’m a heavy user of Microsoft OneDrive.

If I need something, I simply save it into my OneDrive on the remote computer, then I can open it in my OneDrive folder on my Mac, and vice versa. If you aren’t a user of OneDrive or a similar service then this will be a useful tool for you, should you need to share files.

OK, you’re all done, just click the Add button. This computer will now be added to your Microsoft Remote Desktop window.

Connect To a Remote PC

You can connect by simply double clicking on the block with the computer’s name (in this example represented by <name>).

Note the two icons in the upper right of the computer box. The pencil icon can be used to edit the settings we just saw. The trashcan can be used to remove this computer from your remote desktop application.

When you double click on the computer, you may be shown a message “You are connecting to the RDP host <name>. The certificate couldn’t be verified back to a root certificate. Your connection may not be secure. Do you want to continue?

If you are connecting to your own computer, that you trust, likely on your home network, then you can click the Continue button. In a future post we’ll show you how to resolve this so it will skip this dialog.

Once you have connected, you’ll see the remote computer, probably full screen (unless you changed the property back in the Display options).

Exiting a Remote Desktop Session

I will say, it’s not at all intuitive how to switch back to your Apple macOS desktop, or how to exit a remote desktop session once you are in it. Since I’ve shown you how to get into a remote desktop session, I should take a moment and show you how to get out of it.

To switch back to your macOS machine, simply use the CTRL key, plus the left arrow to swap to the previous desktop. Using CTRL plus right arrow will go back to the Remote Desktop session.

If you are using the virtual desktops feature in macOS, you can use CTRL and the left or right arrows to move past the remote desktop session to other macOS virtual desktops, then go back to the remote desktop.

To exit a remote desktop session, while you are looking at your remote computer simply drag your cursor to the very top of the screen and let it sit there a few seconds.

The Apple menu bar will pop up. You can then use the Window menu, and click Close. Alternatively you can click the Red X button in the Remote Desktop window to close the session.

Also note it’s possible to connect to multiple computers at the same time. You can use either the CTRL and left/right arrow to swap between them, or in the Window menu pick a different remote desktop to connect to.

Network Connectivity

Please note that both the Apple Mac and the computer you are remoting to must be on the same network. Typically this will be your home network, or perhaps a work network.

By default, Remote Desktop won’t work if, for example, you go to a coffee shop with your Mac and your Windows computer is still at home.

It is possible to work around this by setting up a VPN connection back to your home network. Setting that up, however, is beyond the scope of this already long blog post.

Summary

In this post, you saw how to install and configure Microsoft Remote Desktop on Apple’s macOS and connect to a Windows Computer. The screen captures were from macOS Big Sur and Windows 10, but I’ve also tested it with Catalina and Mojave.

Closing All Finder Windows at Once in Apple macOS

It’s not uncommon for me to have multiple Finder windows open at once on my Mac. Often I’m cleaning up my drive, moving files from downloads to where I want them.

When I’m done, I naturally want to close all my Finder windows. Normally, if you go to the File menu in Finder, you’ll see an option to close the current window.

It can be annoying, and potentially time-consuming to go to every Finder window and close it. Even if I close using the red X button, I still have to go to each Finder window. It’d be nice to just close them all at once.

This is yet another instance where the OPTION key will be our friend. Simply hold down the OPTION key and the menu option will update.

You can simply click Close All and all open Finder windows will be exited. Alternatively, you can also press CMD+OPTION+W on the keyboard and all your Finder windows will be closed.

As an added bonus, this not only works in Finder but with any application that allows you to have multiple copies of the program open. For example, I opened up multiple copies of BBEdit and using the OPTION key enabled the Close All Windows choice. Do note though, the shortcut key may vary with each application.

This technique works on Big Sur, Catalina, and other recent versions of Apple macOS.

Skip The Countdown When Shutting Down Apple macOS

I’m sure any macOS user knows how to shut down their Apple computer. Just go to the Apple menu in the upper left, click on it, and pick Shut Down…

Doing so pops up a dialog with a count down timer. You can skip the 60 second count down timer by clicking the Shut Down button.

It’s possible though to skip this dialog and shut down your Mac immediately. The trick to this is, as with my previous blog post, using the OPTION key.

With the above menu open, simply hold down the OPTION button. When you do the menu updates.

The change is very subtle, so look closely. The three periods after “Shut Down” disappear. Now when you click shut down, the shut down dialog is by-passed. Your macBook will now shut down immediately.

This technique works on Big Sur, Catalina, as well as several previous versions of macOS.

Moving A File in Apple macOS

I’ve been using Windows since version 2, before that MSDOS all the way back to the earliest version. Thus working in the Microsoft world is very comfortable to me. My earliest exposure to Microsoft was with GWBASIC running on a Radio Shack (Tandy) TRS-80 Model 1.

I’ve been regularly using various distros of Linux for at least five years, perhaps longer, before that I used various UNIX or UNIX based systems. One of the earliest was CP/M on my Commdore 128, or later AmigaOS.

macOS is relatively new to me, I bought my first Mac about 3 years ago. The macOS GUI is very different in terms of commands from Windows or Linux. There are many things that aren’t intuitive to someone coming from another platform. Even though they may seem easy to an experienced Apple user, they took me some time to figure out. I thought I’d spend a few blog post helping out others who are experienced computer users, but relatively new to macOS.

One that befuddled me at first was very simple, moving a file to a different folder. Turns out it’s fairly simple when you know how.

First, open Finder and go to the file you want to move. Right click and pick Copy.

Now go to the folder you want to move the file to. If you right click, you’ll see the Paste option you may have seen before.

Now here comes the secret. Press and hold the OPTION key. When you do, the menu will update.

While the OPTION key is being held down, the Paste option changes to Move Item Here. Click on it and the file will be moved.

As I stated before, this may seem normal to a long time Apple user, but having menus change by holding a key isn’t something normally done in Windows or most Linux distros. As a new macOS user, it never occurred to me to hold down the OPTION key.

Using the OPTION key can unlock all kinds of new menu options, as you will see in upcoming posts.

Note this technique works in Big Sur, Catalina, as well the last several versions of macOS before that.

Exclude A File From Git Source Code Control in VSCode

Like many developers, I use VSCode for my projects. Primarily PowerShell, but also other things like the PHP code used for my ham radio club website or markdown projects.

It can be useful to have extra files, that I don’t need or want to have saved in Git. One example, I often have a “scratchpad.ps1” file. It’s a place I can prototype code, test out ideas, before I copy them into my main project. If this file gets lost, or damaged, I don’t really care as it’s just temporary.

Another example stems from my need to demonstrate code on video, for my Pluralsight courses, or live at SQL Saturdays and code camps. I often need to login to a website or database, and don’t want to have my credentials hard coded in my script for everyone to see.

To solve this, I simply place my needed information in a text file, then use Get-Content (with the -Raw switch) to read it into a variable. I don’t want this text file though to be placed in my public github repositories.

Excluding a file is simple. In the root folder of your source controlled project is a folder named .git. (Note the period on the front, also note that on some operating systems it may be hidden by default.) Under it is another folder called info.

In .git/info is a file called exclude (with no extension). To it, simply add the names of the files you want to exclude from source control. Here’s an example:

# git ls-files --others --exclude-from=.git/info/exclude
# Lines that start with '#' are comments.
# For a project mostly in C, the following would be a good set of
# exclude patterns (uncomment them if you want to use them):
# *.[oa]
# *~
uid.txt

The lines that begin with a pound sign (#) are comments, and are included by git.

Under it is the file I added, uid.txt. This file is will now be excluded from any git commits, and will not be uploaded to github or whatever tool you use for git. You can see this in the VSCode file tree, the file will appear in an off color font. In a dark mode theme, this will be a gray.

The arrow points to the uid.txt file that was excluded from the project.

That’s all there is to it. Now you can include extra files, such as scratch pads, notes, or even passwords that you don’t need (or want) to have as part of your git repository. Just keep in mind it’s your responsibility to back these files up.