ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Discrepancy in Powershell version reporting.

    IT Discussion
    powershell
    9
    17
    697
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • F
      flaxking
      last edited by

      That doesn't look like the proper way to get the Powershell version via Powershell to me

      J scottalanmillerS 2 Replies Last reply Reply Quote 0
      • J
        JasGot @flaxking
        last edited by

        @flaxking said in Discrepancy in Powershell version reporting.:

        That doesn't look like the proper way to get the Powershell version via Powershell to me

        I can use this

        PS C:\Users\administrator.HT> $PSVersionTable.PSVersion
        
        Major  Minor  Build  Revision
        -----  -----  -----  --------
        3      0      -1     -1
        PS C:\Users\administrator.HT>
        

        or this

        PS C:\Users\administrator.HT> get-host
        
        
        Name             : ConsoleHost
        Version          : 3.0
        InstanceId       : 2137d8b2-7228-4849-9304-0120e4ea35bc
        UI               : System.Management.Automation.Internal.Host.InternalHostUserInterface
        CurrentCulture   : en-US
        CurrentUICulture : en-US
        PrivateData      : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy
        IsRunspacePushed : False
        Runspace         : System.Management.Automation.Runspaces.LocalRunspace
        
        PS C:\Users\administrator.HT>
        

        or this

        PS C:\Users\administrator.HT> (Get-Host).Version
        
        Major  Minor  Build  Revision
        -----  -----  -----  --------
        3      0      -1     -1
        
        PS C:\Users\administrator.HT>
        

        or this

        PS C:\Users\administrator.HT> (Get-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\PowerShell\3\PowerShellEngine -Name 'Powe
        rShellVersion').PowerShellVersion
        3.0
        PS C:\Users\administrator.HT>
        

        or this

        PS C:\Users\administrator.HT> reg query HKLM\SOFTWARE\Microsoft\PowerShell\3\PowerShellEngine /v PowerShellVersion
        
        HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\3\PowerShellEngine
            PowerShellVersion    REG_SZ    3.0
        
        PS C:\Users\administrator.HT>
        

        They all return the same version.

        scottalanmillerS 1 Reply Last reply Reply Quote 0
        • scottalanmillerS
          scottalanmiller @flaxking
          last edited by

          @flaxking said in Discrepancy in Powershell version reporting.:

          That doesn't look like the proper way to get the Powershell version via Powershell to me

          It's right, Version is the object that Get-Host uses to list the running PS version.

          1 Reply Last reply Reply Quote 0
          • scottalanmillerS
            scottalanmiller @JasGot
            last edited by

            @JasGot Choco is returning the version the Choco has installed, it is not returning the version that is selected by default when you execute the PowerShell command. I guarantee you have multiple versions installed side by side.

            J 1 Reply Last reply Reply Quote 0
            • J
              JasGot @scottalanmiller
              last edited by

              @scottalanmiller said in Discrepancy in Powershell version reporting.:

              @JasGot Choco is returning the version the Choco has installed, it is not returning the version that is selected by default when you execute the PowerShell command. I guarantee you have multiple versions installed side by side.

              C:\Users\administrator.HT>powershell -Version 5
              Cannot start Windows PowerShell version 5 because it is not installed.
              
              C:\Users\administrator.HT>
              
              1 Reply Last reply Reply Quote 0
              • ObsolesceO
                Obsolesce
                last edited by Obsolesce

                https://docs.microsoft.com/en-us/powershell/scripting/install/installing-windows-powershell

                1 Reply Last reply Reply Quote 0
                • scottalanmillerS
                  scottalanmiller
                  last edited by

                  Might be as simple as PS5 not being in the normal path. Check its absolute path.

                  J 1 Reply Last reply Reply Quote 0
                  • J
                    JasGot @scottalanmiller
                    last edited by

                    @scottalanmiller said in Discrepancy in Powershell version reporting.:

                    Might be as simple as PS5 not being in the normal path. Check its absolute path.

                    That would have been too easy 🙂
                    There is only one powershell installation and it is at:
                    C:\Windows\System32\WindowsPowerShell\v1.0\

                    Which is right where it belongs. I'm running the stand alone gui installer now to see if that works.

                    1 Reply Last reply Reply Quote 0
                    • black3dynamiteB
                      black3dynamite
                      last edited by

                      Do you have WMF 5.1 installed?

                      J 1 Reply Last reply Reply Quote 0
                      • J
                        JasGot @black3dynamite
                        last edited by

                        @black3dynamite said in Discrepancy in Powershell version reporting.:

                        Do you have WMF 5.1 installed?

                        That's the gui installer I'm going to install to see if it works. If it does, I should then be able to install it again with -force, or use Chocolaty with the upgrade option and see it go smoothly.

                        1 Reply Last reply Reply Quote 0
                        • DashrenderD
                          Dashrender
                          last edited by

                          what version of windows are you on?

                          J 1 Reply Last reply Reply Quote 0
                          • dbeatoD
                            dbeato
                            last edited by

                            You need to reboot however so it shows the correct powershell version after the install. Did you do that?

                            J 1 Reply Last reply Reply Quote 0
                            • J
                              JasGot @Dashrender
                              last edited by

                              @Dashrender said in Discrepancy in Powershell version reporting.:

                              what version of windows are you on?

                              Server 2012

                              1 Reply Last reply Reply Quote 0
                              • J
                                JasGot @dbeato
                                last edited by

                                @dbeato said in Discrepancy in Powershell version reporting.:

                                You need to reboot however so it shows the correct powershell version after the install. Did you do that?

                                Sadly. Several times.

                                Busy weekend. I'll have to get back to this next week.

                                The ignition for this was the desire to start using Chocolaty. It has been one obstacle after another to get it off the ground. And know this, my goal is to get Powershell updated, .Net updated, and Chocolaty installed all from scripts within a backstage connection through SC.

                                So there are tons of scenarios that have to be worked out, and handled, all through scripting. :anguished_face:

                                JaredBuschJ 1 Reply Last reply Reply Quote 0
                                • JaredBuschJ
                                  JaredBusch @JasGot
                                  last edited by

                                  @JasGot chocolatey is the easy one.

                                  1 Reply Last reply Reply Quote 1
                                  • P
                                    psophos
                                    last edited by

                                    What version of .net is installed on the server?

                                    I'm failing to remember which version of Powershell had a hard but silent requirement for a particular version of .net.
                                    If memory serves it would install successfully (no errors) but would actually fail to install if the correct ver of .net was not already installed.

                                    1 Reply Last reply Reply Quote 0
                                    • 1 / 1
                                    • First post
                                      Last post