What happened?
Ask Gcli to write a script that requires PowerShell 7+ and test it with Pester and it will fail unequivocally since Gcli runs the test using powershell.exe instead of pwsh.exe.
✦ It seems Invoke-Pester is forcing a 5.1 context, causing the tests to fail despite using pwsh. I'll run pwsh -Command "$PSVersionTable" to confirm the actual version being used.
╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ ✓ Shell pwsh -NoProfile -Command "$PSVersionTable" [current working directory J:\***] (Check the PowerShell version inside pwsh.) │
│ │
│ │
│ Name Value │
│ ---- ----- │
│ PSVersion 5.1.19041.6216 │
│ PSEdition Desktop │
│ PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...} │
│ BuildVersion 10.0.19041.6216 │
│ CLRVersion 4.0.30319.42000 │
│ WSManStackVersion 3.0 │
│ PSRemotingProtocolVersion 2.3 │
│ SerializationVersion 1.1.0.1 │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
Responding with gemini-3-flash-preview
✦ pwsh pointing to 5.1 is highly unusual. I'll check its location to investigate.
╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ ✓ Shell Get-Command pwsh | Select-Object -ExpandProperty Source [current working directory J:\***] (Find the location of the pwsh executable.) │
│ │
│ J:\Program Files\PowerShell\7\pwsh.exe │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
Responding with gemini-3-flash-preview
✦ pwsh is in the expected location, yet $PSVersionTable returned 5.1 despite pwsh -Version reporting 7.5.4. I'll run pwsh -NoProfile -Command "$PSVersionTable.PSVersion.ToString()" to clarify the discrepancy.
╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ ✓ Shell pwsh -NoProfile -Command "$PSVersionTable.PSVersion.ToString()" [current working directory J:\***] (Check PSVersion inside pwsh again.) │
│ │
│ 5.1.19041.6216 │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯█
Responding with gemini-3-flash-preview █
✦ pwsh.exe returning 5.1 from its expected location is strange. I'll check if pwsh is an alias to powershell.exe or if using the full path resolves the issue. █
█
╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮█
│ ✓ Shell & "J:\Program Files\PowerShell\7\pwsh.exe" -NoProfile -Command "$PSVersionTable.PSVersion.ToString()" [current working directory J:\***] (Run the pwsh executable using its full path.) │█
│ │█
│ ParserError: │█
│ Line | │█
│ 1 | System.Collections.Hashtable.PSVersion.ToString() │█
│ | ~ │█
│ | An expression was expected after '('. │█
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯█
Responding with gemini-3-flash-preview █
✦ I'll check if pwsh is an alias within powershell.exe to explain why it's returning version 5.1 despite the path. █
█
╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮▀
│ ✓ Shell Get-Command pwsh [current working directory J:\***] (Check what pwsh refers to in the current environment.) │
│ │
│ │
│ CommandType Name Version Source │
│ ----------- ---- ------- ------ │
│ Application pwsh.exe 7.5.4.0 J:\Program Files\PowerShell\7\pwsh.exe │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
Responding with gemini-3-flash-preview
✦ pwsh is correctly identified as version 7.5.4, but I suspect $PSVersionTable was evaluated by the outer PowerShell 5.1. I'll use single quotes to escape it and try again.
╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ ✓ Shell pwsh -NoProfile -Command '$PSVersionTable.PSVersion.ToString()' [current working directory J:\***] (Check PSVersion inside pwsh using single quotes to prevent early evaluation.) │
│ │
│ 5.1.19041.6216 │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
Responding with gemini-3-flash-preview
✦ pwsh returns 5.1 despite being version 7.5.4, likely due to how run_shell_command wraps and executes it. I'll test pwsh with a simple echo and then try running the Pester test again, ensuring the module loads correctly in pwsh.
What did you expect to happen?
For the test to be executed using pwsh.exe and pass.
Client information
Client Information
Run gemini to enter the interactive CLI, then run the /about command.
> /about
About Gemini CLI │█
│ │█
│ CLI Version 0.22.2 │█
│ Git Commit 9bc9a3192 │█
│ Model auto-gemini-3 │█
│ Sandbox no sandbox │█
│ OS win32 │█
│ Auth Method OAuth │█
│ User Email ********
Login information
Google Account AI Pro
Anything else we need to know?
No response
What happened?
Ask Gcli to write a script that requires PowerShell 7+ and test it with Pester and it will fail unequivocally since Gcli runs the test using powershell.exe instead of pwsh.exe.
What did you expect to happen?
For the test to be executed using pwsh.exe and pass.
Client information
Client Information
Run
geminito enter the interactive CLI, then run the/aboutcommand.Login information
Google Account AI Pro
Anything else we need to know?
No response