- <#
- .Synopsis
- Creates a function to set PowerShell as GUI in Server 2012
- .DESCRIPTION
- The function in this script sets PowerShell as the
- default shell in Server 2012. When the server is rebooted,
- it runs PowerShell.exe by default. When PowerShell starts, it
- displays the $PSVersionTable variable.
- .NOTES
- File Name : Set-PowerShellAsGui.ps1
- Author : Thomas Lee - tfl@psp.co.uk
- Requires : Server 2012
- .LINK
- This script posted to:
- http://www.pshscripts.blogspot.com
- .EXAMPLE
- Left as an exercise to the reader
- #>
- Function Set-PowerShellAsShell {
- [CmdletBinding()]
- Param (
- [switch] $Reboot = $false
- )
- # Create Registry Path variable
- $RegPath = "Microsoft.PowerShell.Core\Registry::"
- $RegPath += "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\"
- $RegPath += "Windows NT\CurrentVersion\winlogon"
- # Create splatted parameter hash table
- $parm = @{Path = $regpath} # key
- $parm += @{Name = 'Shell'} # value name
- $parm += @{Value = 'PowerShell.exe –NoExit
-Command "$psversiontable"'} # value’s value - # Set Registry value entry
- Set-ItemProperty @parm
- # And restart to see PowerShell
- if ($Reboot) {Restart-Computer -confirm}
- }
This blog contains PowerShell scripts, more PowerShell scripts and still more PowerShell scripts. Occasionally you may see some organisational posts.
Wednesday, 3 October 2012
Set-PowerShellAsShell
Labels:
powershell,
PowerShell scripts,
PowerShell V2,
PowerShell v3,
Server,
Server2012,
ServerCore
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment