PowerShell v5 to v7.1 Migration

Welcome Forums General PowerShell Q&A PowerShell v5 to v7.1 Migration

Viewing 1 reply thread
  • Author
    • #280392
      Topics: 5
      Replies: 10
      Points: 93
      Rank: Member

      Update: Below issue corrected after reinstalling Exchange Online Management v2.0.4-Preview. I suspect there was some corruption during the initial install. Thank you. 


      We’re in a hybrid Exchange/O365 environment managed in great part by PowerShell scripts.

      I am trying to migrate scripts from 5.0 to 7.1. I’ve installed PS v7.1 x64 and Exchange Online Management v2.0.4-Preview6.

      The above runs in v5 with the following message:

      Creating a new Remote PowerShell session using Modern Authentication for implicit remoting of “Set-Mailbox” command …

      When the same script is run on v7.1 it fails with the following error:

      Set-Mailbox: Recipient “email-one” couldn’t be read from domain controller “xxxxxxxxxxxxxxxx.PROD.OUTLOOK.COM”. This may be due to replication delays. Switching out of Forest mode should allow this operation to complete successfully.

      Seems like it’s failing to connect to Azure AD. But why v5 connects and not 7.1 ?


      • This topic was modified 1 month ago by obijuan. Reason: Issue resolved
    • #280818
      Topics: 0
      Replies: 5
      Points: 21
      Rank: Member

      For flexibility and to support the needs of IT, DevOps engineers, and developers, there are several options available to install PowerShell 7. In most cases, the installation options can be reduced to the following methods:

      Deploy PowerShell using the MSI package
      Deploy PowerShell using the ZIP package

      Deploying the MSI package requires Administrator permission. The ZIP package can be deployed by any user. The ZIP package is the easiest way to install PowerShell 7 for testing, before committing to a full installation.

      Using PowerShell 7 side-by-side with Windows PowerShell 5.1
      PowerShell 7 is designed to coexist with Windows PowerShell 5.1. The following features ensure that your investment in PowerShell is protected and your migration to PowerShell 7 is simple.

      Separate installation path and executable name
      Separate PSModulePath
      Separate profiles for each version
      Improved module compatibility
      New remoting endpoints
      Group policy support
      Separate Event logs
      Separate installation path and executable name
      PowerShell 7 installs to a new directory, enabling side-by-side execution with Windows PowerShell 5.1.

      Install locations by version:

      Windows PowerShell 5.1: $env:WINDIR\System32\WindowsPowerShell\v1.0
      PowerShell Core 6.x: $env:ProgramFiles\PowerShell\6
      PowerShell 7: $env:ProgramFiles\PowerShell\7
      The new location is added to your PATH allowing you to run both Windows PowerShell 5.1 and PowerShell 7. If you’re migrating from PowerShell Core 6.x to PowerShell 7, PowerShell 6 is removed and the PATH replaced.

      In Windows PowerShell, the PowerShell executable is named powershell.exe. In version 6 and above, the executable is named pwsh.exe. The new name makes it easy to support side-by-side execution of both versions.

      I hope this information will be helpful to migrate Powershell version 5 to 7.1

      Ben Martin

Viewing 1 reply thread
  • You must be logged in to reply to this topic.