Changing Lync/SfB Server PowerShell windows size

A quick way to change the Lync/SfB Server PowerShell window size is to run the following cmdlets:

$pshost = get-host
$pswindow = $pshost.ui.rawui
$newsize = $pswindow.buffersize
$newsize.height = 3000
$newsize.width = 120
$pswindow.buffersize = $newsize
$newsize = $pswindow.windowsize
$newsize.height = 50
$newsize.width = 120
$pswindow.windowsize = $newsize

However, this change is temporary, when we open a new Lync/SfB Server PowerShell it will return to the default values.

To modify the default values we need to change Layout settings in the Lync/SfB Server PowerShell shortcut properties:

Lync Server 2013

C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Microsoft Lync Server 2013

Skype for Business Server 2015

C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Skype for Business Server 2015

Please note that these are the same values as the Windows PowerShell.

After these changes the Lync Server 2013 will work fine:

However, for Skype for Business Server we have an issue when we try to use the SfB PowerShell shortcut:

The string is missing the terminator: ‘.
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : TerminatorExpectedAtEndOfString

The issue is cause by the 260 characters limitation in the Shortcut Target:

We can quickly fix this by using Windows PowerShell:

$ShortcutPath = "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Skype for Business Server 2015\Skype for Business Server Management Shell.lnk"
$Shell = New-Object -ComObject ("WScript.Shell")
$Shortcut = $Shell.CreateShortcut($ShortcutPath)
$Shortcut.Arguments = "-noexit -command "" cd $env:UserProfile; Write-Host 'Loading Modules for Skype for Business Server 2015...'; Import-Module 'C:\Program Files\Common Files\Skype for Business Server 2015\Modules\SkypeForBusiness\SkypeForBusiness.psd1'"""

After this we are able to use Skype for Business PowerShell:

For the Skype for Business Server 2019 PowerShell we don’t need to change the default value:

C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Skype for Business Server 2019



One thought on “Changing Lync/SfB Server PowerShell windows size

  1. The quickest way is just to use the good old “mode” command, remember DOS? like this:
    mode 200 will widen your console screen to 200 chars. Next using WindowsKey+CursorUp will maximize it.
    problem solved within a second, or two.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.