Script to create a Windows 8 Hibernation Tile for the Start menu (PowerShell)

Introduction

This PowerShell Script shows how to create a Windows 8 Hibernation tile for the Start menu.

Scenarios

Properly hibernating Windows 8 without a Start button can be a bit of a chore. Many users may want to hibernate Windows in just one click. This script enables users to click a tile to hibernate Windows on the Start menu.

Note

You must follow these steps before you can execute this script:

Make sure that the system is hibernation enabled. To confirm that, Press Windows key + R, go to Run menu and type in Powercfg.cpl and click OK. In the Power Options Propertiesclick Hibernate tab and make sure that Enable hibernation option is checked. Click OK/Apply.

Script

Step1: Run the script in the Windows PowerShell Console, type the one command: <Script Path> at the prompt.
For example, type C:\Script\ CreateHibernationWindowsTile.ps1
The step is shown in the following figure.

 
When the script finishes running, Windows PowerShell Console displays brief information about the script.
 
The result is shown in the following figure.
 
 
Here are some code snippets for your references. To get the complete script sample, please click the download button at the beginning of this page.
PowerShell
Edit|Remove
#change the default icon of Hibernation shortcut 
$HibernationLnk = $Desktop.ParseName($HibernationShortcutPath$HibernationLnkPath = $HibernationLnk.GetLink 
$HibernationLnkPath.SetIconLocation("$env:SystemRoot\System32\SHELL32.dll",297) 
$HibernationLnkPath.Save()

Prerequisite

Windows PowerShell 3.0

Windows 8

Additional Resources

New-Object