I am reading Windows Powershell™ 2 For Dummies® and chapter 2 explains how to customize the powershell console.
Created a file Microsoft.PowerShellISE_profile.ps1 with the following contents:
$Shell = $Host.UI.RawUI $Shell.WindowTitle="PowerShell Obeys Me" $Shell.BackgroundColor="White" $Shell.ForegroundColor="Blue" $size = $Shell.WindowSize $size.width=120 $size.height=55 $Shell.WindowSize = $size $size = $Shell.BufferSize $size.width=120 $size.height=5000 $Shell.BufferSize = $size Clear-Host
When I load the powershell_ise, it does change the window title, background, foreground colors, but I also receive the following errors:
Property 'width' cannot be found on this object; make sure it exists and is settable. At C:\Users\[user]\Documents\WindowsPowerShell\Microsoft.PowerShellISE_profile.ps1:6 char:7 + $size. <<<< width=120 + CategoryInfo : InvalidOperation: (width:String) [], RuntimeException + FullyQualifiedErrorId : PropertyNotFound
Property 'height' cannot be found on this object; make sure it exists and is settable. At C:\Users\[user]\Documents\WindowsPowerShell\Microsoft.PowerShellISE_profile.ps1:7 char:7 + $size. <<<< height=55 + CategoryInfo : InvalidOperation: (height:String) [], RuntimeException + FullyQualifiedErrorId : PropertyNotFound
Exception setting "WindowSize": "Cannot convert null to type "System.Management.Automation.Host.Size"." At C:\Users\[user]\Documents\WindowsPowerShell\Microsoft.PowerShellISE_profile.ps1:8 char:8 + $Shell. <<<< WindowSize = $size + CategoryInfo : InvalidOperation: (:) [], RuntimeException + FullyQualifiedErrorId : PropertyAssignmentException
How do I fix these errors? |