If you’re anything like me, you use many different machines on a daily or sometimes weekly basis. Some of these are on computers you use during working hours and some during your non-working hours. Well, let’s just call these non-working hours, non-billable-hours right? J As I tend to do quite a bit of work when I’m away from work! Alright… I digressed a bit, but the point is this…We may have an elaborate setup of computers or virtual machines (hopefully following some standard naming convention) that we use to test or learn some new functionality. This was the case for me today. I was trying to do something that required me to use the currently logged in user and machine name. I thought that I was entering in the name correctly because I was entering the name of the VM. Shame on me…I named it differently…
I could have figured out what the name of the machine was several ways, but since I am much quicker at typing, there was one that came bubbling up from the depths of my internal hard drive (brain). I’m not sure when I used it last, but I figured I’d try it anyway. I fired up a command prompt and typed the command “whoami” and hit enter. Sure enough! The command worked and my results were displayed as shown in Figure 1 below.
Figure 1: WhoAmI Results
So, if you ever forget who you are or you just need a reminder of the machine and username that you are logged in with, just fire up a command window and ask Windows….WhoAmI. I hope that you enjoyed this quick blog. And if you don’t already, please be sure to follow me on twitter at @briankmcdonald. Also note that you can subscribe to an RSS feed of my blogs or find me using any of the below methods.
Brian K. McDonald, MCDBA, MCSDBusiness Intelligence Consultant
Blogs: SQLBIGeek | SQLServerCentral | BIDN Articles | BIDN Blogs | SQLServerPedia
That may work in Win7, but that does not work on XP, or WS2K3. It's an unknown command on those two platforms.
Hmmm... I must remember it from my Unix days then. Not too sure. It's down deep in my mind. :) Thanks for letting us know that it doesn't work on the other platforms. You'll just need to use the hostname command to determine computer name (among other ways of course!).