Forum Discussion

loy_5656's avatar
loy_5656
Copper Contributor
Jul 20, 2022

Regarding the different output formats of Powershell Versions 5 and 7.

I use Exchange Online commands through Powershell.

I have noticed that Powershell versions 5 and 7 work differently.

And I would like to achieve an output format like Powershell version 5, but without using the "|Format-table" notation. Is it possible to rewrite the default values?

 

 

Thank you.

 

Powershell version information in use:

PowerShell 5: 5.1.22000.653

and

PowerShell 7: 7.2.5

  • The case has been resolved.

    I found out that it was due to the fact that I was using a preview version of ExchangeOnlineManagement 2.0.6-Preview6.

    This version loads the module when "Connect-ExchangeOnline" is performed, but that step was omitted entirely, so it may be that the cache was still there when the problem was not fixed by restarting.

    PowerShell Gallery | ExchangeOnlineManagement 2.0.6-Preview6

     

    So I fixed it by reinstalling ExchangeOnlineManagement and reverting to version 2.0.5.

     

    Thanks for the solution.

  • farismalaeb's avatar
    farismalaeb
    Steel Contributor

    loy_5656 

    I tried it on the following

    - PowerShell 7 console

    - Windows PowerShell 5.1.19041.1682 console

    - Windows Terminal (Both PS Version)

    two Windows 10 computers, and the result are all the same.

     

    Maybe its related to Windows Terminal, have you tried it on the PS Console instead of Windows Terminal

     

    • loy_5656's avatar
      loy_5656
      Copper Contributor

      farismalaeb 

      I press the Windows button and click on the application that comes up when I search for "Powershell 7".

      However, after launching, it always launches with Windows Terminal.

       

      The following consoles gave the desired results.

      Only with Powershell 7 did it not produce the expected output. (Windows 11)

      - Windows Powershell 5 console

      - Powershell 5 with Windows Terminal

       

      I also tried running Powershell 7 from the Windows Powershell 5.1.22000.65 console by typing "pwsh", but the result was the same.

      Additionally, I tried it on another Windows 11 PC and got the output I wanted with Powershell 7.2.5 on Windows Terminal, so the problem appears to be my current Windows 11 PC.

      • loy_5656's avatar
        loy_5656
        Copper Contributor

        The case has been resolved.

        I found out that it was due to the fact that I was using a preview version of ExchangeOnlineManagement 2.0.6-Preview6.

        This version loads the module when "Connect-ExchangeOnline" is performed, but that step was omitted entirely, so it may be that the cache was still there when the problem was not fixed by restarting.

        PowerShell Gallery | ExchangeOnlineManagement 2.0.6-Preview6

         

        So I fixed it by reinstalling ExchangeOnlineManagement and reverting to version 2.0.5.

         

        Thanks for the solution.

Resources