Thursday 27 December 2012

PowerShell Scripts to create Windows 8 Shutdown, Restart, Logoff, Switch User, Hibernation Tiles


As you know Windows 8 has a Start Screen replacing the Start Menu. And this for many is still the concern as they are used to Windows 7 Start button providing this menu. Though I can say, that with bit of learning and using, you will start liking the Start Screen equally – if not more. But for some Windows 8 users, the main concern is that without the Start menu, it can be a chore to shut down or reboot Windows 8. And many of the Windows 8 users want to shutdown Windows 8 with just a click.
We have already seen 10 different ways you can shutdown or restart Windows 8. In this post, we will see how to create a Shutdown, Restart, Switch User, Hibernation and Logoff tile for Windows 8 using Powershell Script. You don’t have to worry about knowing coding for script.Microsoft TechNet has made available for download a ready-made script that will do the job for you. Just download the script , import and invoke the cmdlet.
Download CreateWindowsTile.zip from TechNet Script Center, to create creatingShutdown/Restart/Logoff Tiles.
Now Let us see how to create these Tiles step by step:
1. First open the Windows PowerShell as Administrator. For this, in Windows 8 Start Screen, just type PowerShell, as soon as you start typing, it’ll list all the apps, so from there, select and  right-click on Windows PowerShell and Run as administrator to open the Windows PowerShell console.
PowerScript1 PowerShell Scripts to create Windows 8 Shutdown, Restart, Logoff, Switch User, Hibernation Tiles
Now here we have to run import module cmdlet to import the downloaded module.
PowerScript2 PowerShell Scripts to create Windows 8 Shutdown, Restart, Logoff, Switch User, Hibernation Tiles
Now run the script in the Windows PowerShell Console, type the command: Import-Module
PowerScript3 PowerShell Scripts to create Windows 8 Shutdown, Restart, Logoff, Switch User, Hibernation Tiles
If everything is fine, you’ll see no error message and will get the prompt. If by any chance if running script is disabled, you might see this error.
PowerScript4 PowerShell Scripts to create Windows 8 Shutdown, Restart, Logoff, Switch User, Hibernation Tiles
You can enable it by issuing the command Set-ExecutionPolicy –ExecutionPolicy RemoteSigned(For more details about Execution Policies, please check - about_Execution_Policies ) and apply the command as per your needs. Say Y to change the Execution Policy.PowerScript5 PowerShell Scripts to create Windows 8 Shutdown, Restart, Logoff, Switch User, Hibernation TilesNow again run the cmdlet Import-Module <Script Path> at the prompt to import CreateWindowsTile.psm1 and you wont get any error.
Now type New-OSCWindowsTile command in the Windows PowerShell Console and this will create a shutdown, restart and logoff Windows 8 tile to the Start menu. And the message will be shown as below.
PowerScript6 PowerShell Scripts to create Windows 8 Shutdown, Restart, Logoff, Switch User, Hibernation Tiles
Now you can close Windows PowerShell Console and check the Start Screen for the shutdown, restart and logoff Windows 8 tiles.
PowerScript7 PowerShell Scripts to create Windows 8 Shutdown, Restart, Logoff, Switch User, Hibernation Tiles
That’s all, now for your convenience, you now have Restart, Logoff, Shutdown tiles with nice logo. Simply click on these tiles to initiate the action.
Do give it a try – it’s not as difficult as it looks. For more details and those interested in more explanation, please check the TechNet Script Center, which also has a video explaining these steps. Visit these pages to create Switch User and Hibernation Tiles.