From 4c24f712ebbb083f8d035b26bb335dcd6f9318af Mon Sep 17 00:00:00 2001 From: Steve Lee Date: Tue, 4 Dec 2018 19:11:59 -0800 Subject: [PATCH] Expose all cmdlets from PSDiagnostics if logman.exe is available (#8366) --- .../Windows/PSDiagnostics/PSDiagnostics.psm1 | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Modules/Windows/PSDiagnostics/PSDiagnostics.psm1 b/src/Modules/Windows/PSDiagnostics/PSDiagnostics.psm1 index d0b184bf44..444eebe8a5 100644 --- a/src/Modules/Windows/PSDiagnostics/PSDiagnostics.psm1 +++ b/src/Modules/Windows/PSDiagnostics/PSDiagnostics.psm1 @@ -437,12 +437,12 @@ namespace Microsoft.PowerShell.Diagnostics } "@ -if ($psedition -eq 'Core') - { - # Currently we only support these cmdlets as logman.exe is not working on Nano/Lot system. - Export-ModuleMember Enable-PSTrace, Disable-PSTrace, Get-LogProperties, Set-LogProperties - } - else - { - Export-ModuleMember Start-Trace, Stop-Trace, Enable-WSManTrace, Disable-WSManTrace, Enable-PSTrace, Disable-PSTrace, Enable-PSWSManCombinedTrace, Disable-PSWSManCombinedTrace, Get-LogProperties, Set-LogProperties - } +if (Get-Command logman.exe -Type Application -ErrorAction SilentlyContinue) +{ + Export-ModuleMember Disable-PSTrace, Disable-PSWSManCombinedTrace, Disable-WSManTrace, Enable-PSTrace, Enable-PSWSManCombinedTrace, Enable-WSManTrace, Get-LogProperties, Set-LogProperties, Start-Trace, Stop-Trace +} +else +{ + # Currently we only support these cmdlets as logman.exe is not available on systems like Nano and IoT + Export-ModuleMember Disable-PSTrace, Enable-PSTrace, Get-LogProperties, Set-LogProperties +}