Use Event Viewer to Find Out Why Windows Shutdown

27, May, 2023

Since development teams rarely notify us server administrators of most of their maintenance, testing, and reboots, it is useful to know how to figure out the reason a system rebooted. This post. will cover how to do this for Windows based systems.

This would apply to any current version of Windows as of this posting. (Server 2003, and Windows 7 through 11, etc.)

Using Event Viewer

Old faithful, and probably one of the more common ways to figure out why your system rebooted is using the “Event Viewer” built into every version of Windows.

To do this you can open the “Run” prompt with “Windows Key + R” on your keyboard, then entering “eventvwr.msc” and hitting OK.


Then in the left pane of the Event Viewer expand “Windows Logs” then right-click on “System” and select “Filter Current Log” from the list of options.


In the “Filter Current Log” window that appears, replace “” with “41, 1074, 1076, 6008”


You can hit OK and this will now filter down to the specified Event IDs, for example:


Of course when you’re viewing the “Filter Current Log” window there are many useful options you can use to filter for other events but this post is focusing on reboots and shutdown events. You can use the time and date to try and narrow down the cause to see if it correlates with Windows updates or a power outage, etc.

A detailed list of Event IDs relevant to reboots, shutdowns, and power loss:

41 	The system has rebooted without cleanly shutting down first.
1074 	The system has been shutdown properly by a user or process.
1076 	User with shutdown privileges logged on after an unexpected restart and specified cause.
6005 	The Event Log service was started. Indicates the system startup.
6006 	The Event Log service was stopped. Indicates the proper system shutdown.
6008 	The previous system shutdown was unexpected.
6009 	The operating system version detected at the system startup.
6013 	The system uptime in seconds.

Using PowerShell

If you’re a command line nerd or like to automate your workloads you can accomplish the same thing through PowerShell with the following command:

Get-WinEvent -FilterHashtable @{ LogName = 'System'; Id = 41, 1074, 6006, 6605, 6008; } | Format-List Id, LevelDisplayName, TimeCreated, Message


You can use the table from the “Event Viewer” portion of this post to modify the event IDs you want to search for as well. Since this is PowerShell you can modify the scope of your investigation and write scripts to help you. For example the following script will show the last 3 days only:

$today = Get-Date
$startDay = $today.AddDays(-5)
$systEvents=Get-WinEvent -LogName System 
$rebootEvents=$systEvents| Where-Object {$_.TimeCreated -gt $startDay} | Where-Object {$_.Id -in $eventIds}  
format-table TimeCreated,Id,Message -AutoSize -wrap -InputObject $rebootEvents

Another major benefit of checking through PowerShell is that you can also check logs remotely with your command or script by utilizing the “-ComputerName” flag, for example:

Get-EventLog -LogName System -ComputerName Server01, Server02, Server03

Since this guide is not focused on PowerShell scripts specifically I will keep it at that.

Using the Command Prompt

Classic but clunky, you can also check through the good old fashioned command prompt built into all versions of Windows, as older systems will not have PowerShell available.

Open the “Command Prompt”, a quick way to do this especially on older systems where you can not easily search the start menu is “Windows Key + R” to launch the “Run…” prompt and enter “cmd” and hit OK.


And use the following command:

wevtutil qe System /q:"*[System[(EventID=41) or (EventID=1074) or (EventID=6006) or (EventID=6005) or (EventID=6008)]]" /c:100 /f:text /rd:true 

Again, the EventID’s can be modified using the table above. This will give you some output like this:


That’s it! These are the three primary methods of checking for shutdown, reboot, or power off events on your Windows based system with methods that should work for older and newer versions as well as a launch pad for how you can add the commands to a script to help automate your investigation.

Patiently Gaming

24, May, 2023

It was about 6 to 7 years ago when my aging computer was starting to show its wear. The 4th generation i7 processor, SATA2 connections, and well used AMD RX480 were warning me that I would need to upgrade my computer within the next couple of years and there wasn’t any components I currently had that were worth salvaging. Though I managed to squeeze a few more years out of it I really held back on the games I chose to play, I did not want to compromise on quality to gain a few more frames per second.

Rather than play a game at a lower-than-native resolution or on low/medium settings I’d just not play it at all and I was fine with that. I would consider that many, if not all games are an art form that deserve to be played as the developer intended to get the true experience.

I Accidentally Became a Patient Gamer

At that point I decided that while I still allowed myself to take part in Steam sales for games I wanted to play in the future, that I would focus on the backlog of games I currently had. Like most Steam users that backlog is massive even to this day!

I thought it was clever because now I could play “anything I wanted” at maximum resolution, detail, etc. years after most of these games release date without any bottlenecks in my system. What was also obvious in hindsight but highlighted when I played this way is that the majority of games are patched, polished, updated, GOTY’d, DLC released, and in some cases re-mastered and given to me for free. (Metro 2033, or Divinity: Original Sin, for example.)

To this day I still have not touched Cyberpunk 2077, nor do I yet own it as the price keeps getting lower every Steam sale (another benefit of gaming patiently…) and that’s okay because I still have plenty of stuff to play. Because I did not pre-order or get aboard the hype train I missed out on the disappointment that most players had on release. It wasn’t until a year later the game was patched to a playable state and they are still releasing periodic major updates to address complaints. This is just one example of many in the recent AAA gaming market.

The longer I wait the better experience I have. I think that with the exception of very social games like MMORPG’s and multiplayer only titles this is always the case. There is no point subjecting yourself to featureless early access titles or buggy early releases and sometimes never revisiting that game again on its full release because you’ve worn yourself out on simple mechanics just because you like the premise of what a game could be.

Turns Out Half of a Million People had the Same Idea

Unknown to me there was already a community forming around this concept and growing quickly. I’m fairly certain the term “patient gaming” was first coined by the subreddit /r/patientgamers and it’s stuck around for 11 years. By their definition it is:

A gaming sub free from the hype and over saturation of current releases, catering to gamers who wait at least 12 months after release to play a game. Whether it’s price, waiting for bugs/issues to be patched, DLC to be released, don’t meet the system requirements, or just haven’t had the time to keep up with the latest releases.

I suppose it was inevitable with the development and release cycles of games these days, as well as the fact that the large majority of developers restrict themselves to develop for limited resource systems so they can sell on as many platforms as possible. There is little incentive to push the boundaries or develop new game engines if they won’t play on every console and mobile device available. (Do YoU gUyS nOt HaVe PhOnEs?)

Stay Out of the “Bleeding Edge” Rat Race

Even now my “new” PC that I purchased in January of 2021 with a 10th generation Intel i7 and a Nvidia RTX 3080 is, by the internets standards, old news. There are now versions of RTX and DLSS that won’t be compatible with my video card. I’m not saying this as a complaint or a “cope” as the children say these days, but more as advice that there is no use scrambling to have the latest hardware available.

There still haven’t been any games released that I can’t play in the quality and resolution that I like, and there won’t be for a few years. Ultimately that doesn’t matter anyways because to this day I am still playing through the backlog I started almost 7 years ago and am pretty far from catching up.

How I Learned to Stop Worrying and Love the Backlog

As previously mentioned, many PC gamers suffer from having a huge back catalog of games they finished or even installed before. Figuring out a new game to play can be daunting, even stress inducing for some. Something that used to bring joy and stress relief is now overwhelming, yet routine and mundane.

If you have this problem the honest truth is you (and I!) are spoiled. It’s just that simple, you are just spoiled for choice and it is giving you decision paralysis. If you can, think back to a time when maybe you were younger or didn’t have as much money so you only had one game to play. You can probably think of at least one game you played over and over and over again, explored every bit of the level, tried to jump on every ledge and find every secret. Played it incorrectly on purpose, got bored playing “how you are supposed to” and role played as an NPC… Now think of a game you have played like this as an adult. It’s probably a bit harder.

I’m not saying that you should play every game you own in this way, but I have found it rewarding to play games purposefully and thoughtfully. Our attention spans and “joy receptors” have been flayed by modern technology. For example I would be surprised if anyone actually reads this article this far.

**Important Note: This next part is mostly relevant to single player titles, unless you have like minded patient gamer friends and the games servers are still available to host.

I developed a little “system” to help me genuinely enjoy what I play (for the most part, but that will be for another post… looking at you Alan Wake) while tackling my backlog. Something my childhood-self would never believe but this system of playing video games will require some self-control and discipline:

  • Pick the initial game you feel like playing. (Off to a tricky start!)
  • Do not play any other games until you finish the one you chose. (This is the discipline part.)
  • Play the game on easy or normal difficulty. (Yes, really.)
  • Stay away from optional side missions, activities, crafting, and gathering. (Unless you really, really enjoy them.)
  • When you get frustrated, you can stop any time and take a break but do not start any other games.
  • Play the game to completion. (Yes, this can take months. It took me almost a full year of this method to beat Red Dead Redemption 2, but I completed it!)
  • Pick your next game, but most importantly: chose a entirely different genre and style. (Can’t stress this enough!)

The last step is by far the most important. Even if you really enjoyed what you just played, don’t play the sequel (yet!) and break up the experience. For example I am currently playing through “Metro: Last Light” which is a first person shooter, story based, linear, post-apocalyptic, sci-fi styled game. Using the system I outlined above the next game you should be looking for could be a medieval, third-person adventure platformer or a real time strategy game like Age of Empires or Company of Heroes.

Here is an example of the games I have completed in the last few years since about mid-2020, in order, using this system. Take note of the games and their general style and length to see how I mix it up:

  1. Black Mesa
  2. Deadlight
  3. Half-Life 2: Episode One and Two (Broke my own rule!)
  4. Art of Rally
  5. Portal
  6. Shadow Tactics: Blades of the Shogun
  7. Metro 2033 Redux
  8. Mirror’s Edge: Catalyst
  9. Alan Wake
  10. DOOM: Eternal
  11. A Plague Tale: Innocence
  12. CONTROL: Ultimate Edition
  13. Crysis Remastered
  14. Red Dead Redemption 2
  15. Warhammer 40K: Space Marine Remastered
  16. Age of Empires IV (Campaign)
  17. Quake
  18. Days Gone
  19. Kingdom Come: Deliverance
  20. Tomb Raider (2013)
  21. Currently playing Metro: Last Light Redux

As you can see that either stylistically through visuals or setting the games vary quite a bit and they play quite differently one to the next. I also used to pick games by their length to slip in between longer ones. By incorporating games based on length I opened up my view to games I never thought I would play but actually enjoyed quite a bit, examples of these games include Deadlight, and Tomb Raider 2013.

Consider this post a prologue to my “game review” series of posts, reviews will include every title listed above so this is an explanation to why I am reviewing seemingly random old video games that nobody cares about anymore.

Again I am mostly doing this for myself as some kind of journal I suppose, but maybe this system could help you enjoy gaming again like it has for me!

How to Zip and Unzip Files in Linux

23, May, 2023

An important thing to note is that I prefer to learn how to do as much as I can through the command line of any operating system, storage, or networking hardware. While most services these days provide an intuitive GUI I don’t think your knowledge of the OS is complete until you can do everything you need from the CLI. The funny thing is though it can be daunting at first, once you are used to it you will actually prefer it because of how powerful yet simple it can be if you use it the right way.

Diving into something simple, this post will cover how to zip and unzip files in Linux.

Why would you ever want to use a .zip on a Linux server? A few reasons, it is very popular and available to the majority of the computing market via the Windows operating system. It’s an easy way to bundle a large folder of many files into one file, which is easier to manage or transfer over the network. Maybe you’re working on a Windows computer and want to quickly send something over via SFTP, you can create a .zip in seconds.

While .zip files are one of the most widely used formats for compressing and archiving it is not installed by default on most Linux distributions so you will need to install it first.

Installing zip and unzip

Installing unzip with apt (Ubuntu and Debian based systems)

sudo apt install zip unzip

Install unzip with yum (CentOS and RedHat based systems)

sudo yum install zip unzip

zip a Folder

The simplest way to zip to a folder is to use the recursive option with “-r” for example:

zip -r /path/to/directory

This will create a .zip file in your current directory named “” with the folder/directory you have specified, in this case “/folder/you/want/to/zip” but these variables can obviously be changed to suit your needs.

unzip a Folder

So now you have where you want it, but you need to unpack it. It’s very simple!


The contents of have now unpacked into your current directory. Most likely you will want to specify the directory you want to unzip yourself, in which case you can specify this with the “-d” modifier:

unzip -d /path/to/directory

Other modifiers you might want to pair with this are:

“-o” this will overwrite existing files without prompting.
“-n” this will skip the extraction/overwriting of existing files.
“-q” this will run unzip quietly and wont fill your screen with a huge wall of text.

If you have a bunch of .zip files in a single directory, with the power of the command line you can use regular expressions to unzip them all at once with the following command.

unzip '*.zip'

Where the asterisks is a wildcard so this will run the command on all .zip files in the specified directory, for example:

unzip /path/to/directory/'*.zip'

If you want to view the contents of a .zip files before you do anything with it you can simply run it with the “-l” argument:

unzip -l

Stringing it Together

If you’ve stuck with it for this long, you probably know enough to get your intended task done - However as a bonus I will give a couple examples of how you can use some of what you learned here to string together a few arguments that you might see in a real world setting.

The following: will create a .zip file using multiple directories you specify using a space in between each path:

zip -r /path/to/folder1 /path/to/folder2 /path/to/folder3

This will quietly create a zip file named in the directory /home/tutorials/testing:

zip -q -r /path/to/directory/ /path/to/folder/you/want/to/zip

The below example will create a .zip file of all the .jpeg files in the specified directory using a wildcard:

zip /path/to/directory/*.jpeg

Every so often you may come across a password protected .zip file, you should never use the -P modifier to input the password as the plain text will be written to your bash history and could pose a serious security threat, instead if you unzip a file as you normally would you will simply be prompted for the password instead:


[] file1.txt password: 

Your password will not be stored in history, but it will be used for the rest of the encrypted files within the .zip file you are trying to unzip.


I hope you found this useful if you found it at all. This guide, like most, is just the tip of the iceberg when it comes to more advanced usage of Linux applications. Just by running the “zip” and “unzip” commands on their own you will see the huge list of additional modifiers you can explore, string together, and learn about:

[darek@rhel9lab ~]$ zip
Copyright (c) 1990-2008 Info-ZIP - Type 'zip "-L"' for software license.
Zip 3.0 (July 5th 2008). Usage:
zip [-options] [-b path] [-t mmddyyyy] [-n suffixes] [zipfile list] [-xi list]
  The default action is to add or replace zipfile entries from list, which
  can include the special name - to compress standard input.
  If zipfile and list are omitted, zip compresses stdin to stdout.
  -f   freshen: only changed files  -u   update: only changed or new files
  -d   delete entries in zipfile    -m   move into zipfile (delete OS files)
  -r   recurse into directories     -j   junk (don't record) directory names
  -0   store only                   -l   convert LF to CR LF (-ll CR LF to LF)
  -1   compress faster              -9   compress better
  -q   quiet operation              -v   verbose operation/print version info
  -c   add one-line comments        -z   add zipfile comment
  -@   read names from stdin        -o   make zipfile as old as latest entry
  -x   exclude the following names  -i   include only the following names
  -F   fix zipfile (-FF try harder) -D   do not add directory entries
  -A   adjust self-extracting exe   -J   junk zipfile prefix (unzipsfx)
  -T   test zipfile integrity       -X   eXclude eXtra file attributes
  -y   store symbolic links as the link instead of the referenced file
  -e   encrypt                      -n   don't compress these suffixes
  -h2  show more help

[darek@rhel9lab ~]$ unzip
UnZip 6.00 of 20 April 2009, by Info-ZIP.  Maintained by C. Spieler.  Send
bug reports using; see README for details.

Usage: unzip [-Z] [-opts[modifiers]] file[.zip] [list] [-x xlist] [-d exdir]
  Default action is to extract files in list, except those in xlist, to exdir;
  file[.zip] may be a wildcard.  -Z => ZipInfo mode ("unzip -Z" for usage).

  -p  extract files to pipe, no messages     -l  list files (short format)
  -f  freshen existing files, create none    -t  test compressed archive data
  -u  update files, create if necessary      -z  display archive comment only
  -v  list verbosely/show version info       -T  timestamp archive to latest
  -x  exclude files that follow (in xlist)   -d  extract files into exdir
  -n  never overwrite existing files         -q  quiet mode (-qq => quieter)
  -o  overwrite files WITHOUT prompting      -a  auto-convert any text files
  -j  junk paths (do not make directories)   -aa treat ALL files as text
  -U  use escapes for all non-ASCII Unicode  -UU ignore any Unicode fields
  -C  match filenames case-insensitively     -L  make (some) names lowercase
  -X  restore UID/GID info                   -V  retain VMS version numbers
  -K  keep setuid/setgid/tacky permissions   -M  pipe through "more" pager
  -O CHARSET  specify a character encoding for DOS, Windows and OS/2 archives
  -I CHARSET  specify a character encoding for UNIX and other archives

See "unzip -hh" or unzip.txt for more help.  Examples:
  unzip data1 -x joe   => extract all files except joe from zipfile
  unzip -p foo | more  => send contents of via pipe into program more
  unzip -fo foo ReadMe => quietly replace existing ReadMe if archive file newer

As I mentioned before, these guides and posts will most likely be quick and focused on single tasks that you would find in real world day-to-day settings. My hope is to post guides consistently enough that you can learn a broad spectrum of basic Linux administrative tasks and build a usable foundation for yourself. Or you found this post on Google as a one-off and did what you needed to do and will never touch the command line again.

A Place to Archive my Thoughts

22, May, 2023

I’ve been sitting on this domain for years now, recently buying an SSL certificate motivated me a little further along so I finally found a use for this domain.

While a lot of planning and preparation did not go in to it, I have always had a general idea of what style of blog I would run one day. Hopefully this will become a place of personal development, somewhere I can archive the little daily snips and scripts I find myself using here and there between work and home that can help others.

Some things I am brushing up on recently are NetApp ONTAP cluster administration, DNS management, and completely new to me is containerization such as Docker and Kubernetes. To accommodate all of this, this past year I built a little IT home lab running VMWare ESXi to virtualize a bunch of servers. To add extra challenge this is all with different varieties of Linux OS’s than I am used to. This is the type on content you can expect to see here.

Of course no blog is complete without a little personality (unless you have chatGPT generate it for you) so I will include the odd rants and raves about whatever industry related nonsense is on my mind, be it technology or gaming. In the end it doesn’t matter because with almost two decades of hosting various websites under my belt I’ve come to the realization I make these sites for myself.

This site will evolve naturally with however I use it, or it might vanish altogether like most of my websites eventually do! Who knows?