diff --git a/packages/powershell/oh-my-posh/oh-my-posh.psm1 b/packages/powershell/oh-my-posh/oh-my-posh.psm1 index ecb4b6b7c048..bc1cfbe4c5e4 100644 --- a/packages/powershell/oh-my-posh/oh-my-posh.psm1 +++ b/packages/powershell/oh-my-posh/oh-my-posh.psm1 @@ -27,7 +27,7 @@ if ($PSVersionTable.PSEdition -eq "Core" -and !$IsWindows) { function Set-PoshContext {} function Set-GitStatus { - if (Get-Command -Name "Get-GitStatus" -ErrorAction SilentlyContinue) { + if (Get-Module -Name "posh-git") { [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSProvideCommentHelp', '', Justification='Variable used later(not in this scope)')] $Global:GitStatus = Get-GitStatus } diff --git a/src/init/omp.ps1 b/src/init/omp.ps1 index 5f2965238554..f8b9b5b5efbc 100644 --- a/src/init/omp.ps1 +++ b/src/init/omp.ps1 @@ -8,7 +8,7 @@ if (Test-Path "::CONFIG::") { function Set-PoshContext {} function Set-GitStatus { - if (Get-Command -Name "Get-GitStatus" -ErrorAction SilentlyContinue) { + if (Get-Module -Name "posh-git") { [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSProvideCommentHelp', '', Justification='Variable used later(not in this scope)')] $Global:GitStatus = Get-GitStatus }