Script to create a Shutdown/Restart/Logoff Windows 8 Tile for the Start menu(PowerShell)

Introduction

This PowerShell Script shows how to create a Shutdown, Restart or Logoff Windows 8 tile for the Start menu.

Scenarios

Many users would like to shut down or reboot Windows 8 in just one click. This script enables users to click a tile to shut down, reboot or log off Windows on the Start menu.

Script

Step 1: Start the PowerShell Console with administrator. To run the script in the Windows PowerShell Console, type the command< Script Path> at the Windows PowerShell Console.

Step 2: If you want to know how to use this script. You can type the command Get-Help C:\Script\CreateWindowsTile.ps1 -Full to display the entire help file for this function, such as the syntax, parameters, or examples.
 

Here are some code snippets for your references.

PowerShell
Edit|Remove
#create a new shortcut of shutdown 
$ShutdownShortcutPath = "$env:ProgramData\Microsoft\Windows\Start Menu\Programs\Shutdown.lnk" 
$ShutdownShortcut = $WshShell.CreateShortcut($ShutdownShortcutPath$ShutdownShortcut.TargetPath = "$env:SystemRoot\System32\shutdown.exe" 
$ShutdownShortcut.Arguments = "-s -t 0" 
$ShutdownShortcut.Save() 
  
#change the default icon of shutdown shortcut 
$ShutdownLnk = $Desktop.ParseName($ShutdownShortcutPath$ShutdownLnkPath = $ShutdownLnk.GetLink 
$ShutdownLnkPath.SetIconLocation("$env:SystemRoot\System32\SHELL32.dll",27) 
$ShutdownLnkPath.Save()

Example

Example 1: Type C:\Script\CreateWindowsTile.ps1 in the Windows PowerShell Console.

It will create a shutdown, restart and logoff Windows 8 tile to the Start menu.

As you can see, in the following figure, the shutdown, restart and logoff Windows 8 tile has been created successfully.

Prerequisite

Windows PowerShell 3.0

Windows 8

Additional Resources

New-Object