PowerShell 7 not backwards compatible: 2 problems here.

Welcome Forums General PowerShell Q&A PowerShell 7 not backwards compatible: 2 problems here.

  • This topic has 4 replies, 4 voices, and was last updated 3 weeks ago by
    Participant
    .
Viewing 4 reply threads
  • Author
    Posts
    • #226990
      Participant
      Topics: 11
      Replies: 18
      Points: 29
      Rank: Member

      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.

       

       

    • #227035
      Participant
      Topics: 4
      Replies: 2249
      Points: 5,494
      Helping Hand
      Rank: Community MVP

      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.

    • #227416
      Participant
      Topics: 11
      Replies: 18
      Points: 29
      Rank: Member

      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.

    • #227437
      Senior Moderator
      Topics: 8
      Replies: 1215
      Points: 4,335
      Helping Hand
      Rank: Community Hero

      The script is a compiled DLL  one.

      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.

    • #227605
      Participant
      Topics: 6
      Replies: 93
      Points: 428
      Helping Hand
      Rank: Contributor

      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.

       

Viewing 4 reply threads
  • You must be logged in to reply to this topic.