Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Reformat the Window for PowerShell Web Access
function Set-PSWAWindowSize
{
<#
.SYNOPSIS
Reformat the Window for PowerShell Web Access
.DESCRIPTION
This function reformats the PowerShell Web Access windows style to fit a bit better.
.EXAMPLE
PS C:\> Set-PSWAWindowSize
.NOTES
I use PowerShell Web Access a lot while traveling. That comes handy,
because I don't need a working VPN and with an App (comes free from
Sapien) even triggering some long-running scripts from the iPad out of
a Hotel room as no longer a pain. And it doesn't use a lot of data.
Author: Joerg Hochwald - http://jhochwald.com
This script is public domain! IT COMES WITH NO WARRANTY!
.LINK
https://gist.github.com/jhochwald/76950f1eef380a73bcb11cf55d0d0901
.LINK
https://hochwald.net/configure-windows-powershell-web-access/
#>
[CmdletBinding(SupportsShouldProcess = $true)]
param ()
if ($pscmdlet.ShouldProcess('PowerShell Window', 'Tweak it for PSWA usage'))
{
# Get the BufferSize
$bufferSize = $Host.UI.RawUI.BufferSize
# Tweak the BufferSize
$bufferSize.Width = 180
$Host.UI.RawUI.BufferSize = $bufferSize
# Get the WindowSize
$WindowSize = $Host.UI.RawUI.WindowSize
# Tweak the WindowSize
$WindowSize.Width = 180
$WindowSize.Height = 40
$Host.UI.RawUI.WindowSize = $WindowSize
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment