Script to create a Shutdown, Restart, Log off, Hibernate and Switch user tile for the start menu in Windows 8 by using Powershell

Notes:

The full article and the files needed can be found in my post at Technet.

Scenario

Since the removal of the start-button in Windows 8, many users decide to shutdown their computers by pressing the powerbutton, instead of sutting it down correctly with a few extra clicks. This script will create tiles on your start menu for the most common tasks.

  • Shutdown
  • Restart
  • Log off
  • Hibernate
  • Switch user

Script

Step 1: Start with opening a Powershell as administrator and type the following command Import-Module <path to script>, and press enter.
Import-Module

Step 2: To see a list of all commands and to get help on syntax, parameters and to see some examples, type Get-Help New-OSCWindowsTile -Full
Get-Help

Example 01

To add all of the tiles, type the following in the Powershell New-OSCWindowsTile and press enter.
create

When you open the start menu, you should see that the following icons have appeard.

Example 02
To add individual tiles, type one of the following commands in the Powershell and press enter.

  • New-OSCWindowsTile -ShutdownTile
  • New-OSCWindowsTile -RestartTile
  • New-OSCWindowsTile -LogoffTile
  • New-OSCWindowsTile -HibernateTile
  • New-OSCWindowsTile -SwitchUserTile

SingleTile

Sample code (Download to get the full code)

#create a new shortcut of SwitchUser 
$SwitchUserShortcutPath = "$env:ProgramDataMicrosoftWindowsStart MenuProgramsSwitchUser.lnk" 
$SwitchUserShortcut = $WshShell.CreateShortcut($SwitchUserShortcutPath) 
$SwitchUserShortcut.TargetPath = "$env:SystemRootSystem32tsdiscon.exe" 
$SwitchUserShortcut.Save() 

#change the default icon of restart shortcut 
$RestartLnk = $Desktop.ParseName($RestartShortcutPath) 
$RestartLnkPath = $RestartLnk.GetLink
This entry was posted in Powershell, Windows 8 and tagged , , , , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *