Windows 8 and Win + X

I have been using Windows 8 for some time now and for the most part I have adapted to the changes. There are a couple of things that are still a bit annoying. For example, logging off or restarting the computer is an effort that I’d rather avoid. Not too long ago I stumbled across a post on being able to add shortcuts to the Win + X context menu within Windows 8.

First of all, for those who don’t know, the Win + X context menu is a nice and easy way of getting to the most popular tools for Windows with the press of a couple of keys on the keyboard.

Secondly, it is pretty simple to add, remove or change these shortcuts. The Win + X shortcuts come from the C:\Users\<username>\AppData\Local\Microsoft\Windows\WinX. This means you can simply add shortcuts to the existing Group folders located there, or add another Group folder in the same format.

Lastly, if that is too complicated for you, there is an application available from WinAero that can help you add, remove and change the shortcuts available from the Win + X menu. For more information, you may find this blog post useful.

Now with this in mind, I have created a few PowerShell scripts so that I can Logoff, Restart, Shudown, plus more all with a couple of key presses!

Until next time!

PowerShell Script: Move and Rename Log Files

Recently, I had a requirement to move log files out of a folder before the next 24 hour period began. The reason for this was because the log files were being amended to each day. This was generating some very big log files and making it difficult to determine events that occurred on a particular day as each file name only contained a timestamp.

So I quickly wrote up a PowerShell script to grab the files modified in the last 12 hours and move them to a separate folder and then renaming them to include today’s date as a prefix in the file name. I then have a scheduled task set to run the script every 12 hours. It is a very simple script but I have set some variables at the top so anyone can easily reuse the script if they need it.

Until next time!

## Set time frame
$date = (Get-Date).AddHours(-12)
## Get Today's Date
$today = Get-Date -Format yyyyMMdd
## Set Source Folder
$source = "E:\Log\"
## Set Destination Folder
$destination = "E:\LogArchive\"

## Get list of files to Move
$files = Get-ChildItem $source | Where-Object {$_.LastWriteTime -lt $date}

## Move and Rename the files
foreach ($file in $files){
 Move-Item $source$file $destination
 Rename-Item $destination$file $destination$today$file