Gordon
Gordon

Reputation: 6863

Powershell Windows 10 changes/bugs documentation

I am trying to migrate some code to Windows 10/PS 5 and having issues. It started with MS killing the ability to Pin to Taskbar, and now I am having issues with the assignment lines flagged in the code below. I am wondering if there is some sort of a resource document for all the changes/bugs in PowerShell 5, or am I going to just be waiting for things to break and then Googling to find solutions/bugs?

$psHost = Get-Host
$psWindow = $psHost.ui.rawui  

$newSize = $psWindow.buffersize
$newSize.width = 90
$newSize.height = 1000
$psWindow.buffersize = $newSize ###
$newSize = $psWindow.windowsize
$newSize.width = 90
$newSize.height = 50
$psWindow.windowsize = $newSize ###

Upvotes: 2

Views: 279

Answers (1)

Booga Roo
Booga Roo

Reputation: 1781

There is no solidified resource that can tell us what's usable in a given version since you can mix and match PowerShell version 2.0 and 5.0 with (currently supported)Windows 7 and up.

PowerShell v5 can be installed on Windows 7 and later. This means there's a lot of things that can be different between which version of Windows you're running and which version of .Net you're running.

For a quick read of what's different in PowerShell 5.0, I'd suggest this article: https://technet.microsoft.com/en-us/library/hh857339.aspx

One of the more notable improvements I've come across so far is that PowerShell 5 finally enabled transcripts to be used in the PS ISE(integrated scripting environment).

If your workplace has modern machines with Windows 10, it is easy to write scripts with that in mind. Otherwise, it's best to write scripts for the lowest common denominator in use. I often find clients that still have Windows XP and Windows Server 2003, so I try to write scripts with PowerShell 2.0 in mind.

==

As for the window size, the comment from PetSerAl is quite usable(adopting in answer since comments are sometimes subject to deletion):

Since window size can not be greater than buffer size:

$psHost = Get-Host
$psWindow = $psHost.ui.rawui
$psWindow.WindowSize = @{Width=1; Height=1}
$psWindow.BufferSize = @{Width=90; Height=1000}
$psWindow.WindowSize = @{Width=90; Height=50}

Upvotes: 1

Related Questions