From d59710d31039d0b00a94e1e6d6910d0d1b5aa8d0 Mon Sep 17 00:00:00 2001 From: Andrew Schwartzmeyer Date: Tue, 9 Aug 2016 16:02:12 -0700 Subject: [PATCH] Remove unimplemented Management cmdlets from Unix These are not currently implemented and so should not show up as available. The *-Computer cmdlets are already not compiled for Unix (and so not available), so let's not declare them in the manifest. The Get-ComputerInfo cmdlet does not work on Unix and so should not be made available. Test-Connection depends on an unavailable WMI provider. Get/Set-TimeZone are not yet ported. --- .../Microsoft.PowerShell.Management.psd1 | 18 +---------- .../Unimplemented-Cmdlet.Tests.ps1 | 30 +++++++++++++++++++ 2 files changed, 31 insertions(+), 17 deletions(-) create mode 100644 test/powershell/Modules/Microsoft.PowerShell.Management/Unimplemented-Cmdlet.Tests.ps1 diff --git a/src/Modules/Unix/Microsoft.PowerShell.Management/Microsoft.PowerShell.Management.psd1 b/src/Modules/Unix/Microsoft.PowerShell.Management/Microsoft.PowerShell.Management.psd1 index 11aff65840..16b1f5aad8 100644 --- a/src/Modules/Unix/Microsoft.PowerShell.Management/Microsoft.PowerShell.Management.psd1 +++ b/src/Modules/Unix/Microsoft.PowerShell.Management/Microsoft.PowerShell.Management.psd1 @@ -7,7 +7,6 @@ ModuleVersion="3.1.0.0" PowerShellVersion="3.0" NestedModules="Microsoft.PowerShell.Commands.Management.dll" HelpInfoURI = 'http://go.microsoft.com/fwlink/?linkid=390785' -AliasesToExport = @("gin", "gtz", "stz") FunctionsToExport = @() CmdletsToExport=@("Add-Content", "Clear-Content", @@ -48,21 +47,6 @@ CmdletsToExport=@("Add-Content", "Remove-ItemProperty", "Rename-ItemProperty", "Resolve-Path", - "Get-Service", - "Stop-Service", - "Start-Service", - "Suspend-Service", - "Resume-Service", - "Restart-Service", - "Set-Service", - "New-Service", "Set-Content", - "Set-ItemProperty", - "Test-Connection", - "Restart-Computer", - "Stop-Computer", - "Rename-Computer", - "Get-ComputerInfo", - "Get-TimeZone", - "Set-TimeZone") + "Set-ItemProperty") } diff --git a/test/powershell/Modules/Microsoft.PowerShell.Management/Unimplemented-Cmdlet.Tests.ps1 b/test/powershell/Modules/Microsoft.PowerShell.Management/Unimplemented-Cmdlet.Tests.ps1 new file mode 100644 index 0000000000..be7bbea13c --- /dev/null +++ b/test/powershell/Modules/Microsoft.PowerShell.Management/Unimplemented-Cmdlet.Tests.ps1 @@ -0,0 +1,30 @@ +Describe "Unimplemented Management Cmdlet Tests" -Tags "CI" { + + $Commands = @( + "Get-Service", + "Stop-Service", + "Start-Service", + "Suspend-Service", + "Resume-Service", + "Restart-Service", + "Set-Service", + "New-Service", + + "Restart-Computer", + "Stop-Computer", + "Rename-Computer", + + "Get-ComputerInfo", + + "Test-Connection", + + "Get-TimeZone", + "Set-TimeZone" + ) + + foreach ($Command in $Commands) { + It "$Command should only be available on Windows" { + [bool](Get-Command $Command -ErrorAction SilentlyContinue) | Should Be $IsWindows + } + } +}