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.

Demo

Get Microsoft Silverlight

Scenarios

Correctly shutting down or rebooting Windows 8 without a Start button can be difficult. Many users want to shut down or reboot Windows 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

Step1: Run the script in the Windows PowerShell Console, type the one command: Import-Module <Script Path> at the prompt.
For example, type Import-Module C:\Script\ CreateWindowsTile.psm1
This is shown in the following figure.

Step 2: You can type the command Get-Help New-OSCWindowsTile -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. To get the complete script sample, please click the download button at the beginning of this page. 

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 New-OSCWindowsTile command in the Windows PowerShell Console.

This command 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