PowerShell 7 not backwards compatible: 2 problems here.

1, Write-Eventlog fails.

2, The following error is generated by a script (it just removes a number of lines above a certain length); and was working fine on PS5.1:

Could not load type ‘Microsoft.VisualBasic.Devices.Computer’ from assembly ‘Microsoft.VisualBasic, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’

The script is a compiled DLL one.

 

 

And what’s the question? If you cannot use PS version 7 because compatibility problems you should keep using version 5.1. It will be available for a looooong time. So no need to migrate old scripts.
Did you move the script to a newer version of Windows? Here is an excerpt from the Help of Write-EventLog:

“The cmdlets that contain the EventLog noun (the EventLog cmdlets) work only on classic event logs. To get events from logs that use the Windows Event Log technology in Windows Vista and later versions of the Windows operating system, use the Get-WinEvent cmdlet.”

So you might use New-WinEvent instead.

No question, just stating a fact. The script was working fine on PS5.1 on Windows 10 in the standard InternetExplorer Event Log. Installing PS7 in parallel generates the above errors.

Can you tell a little more about this ?

And installing PowerShell 7 should not effect 5.1. Both are not depended and doesn’t know each other.

PS7 (and 6) are open source and VB is not. The behavior you are seeing using PS7 is something I would expect.

https://www.techrepublic.com/article/a-tale-of-two-powershells-which-is-the-right-version-for-you/

Basically, if they cant support it across all open source platforms, it simply aint there.