Disable cmdlets that are not supported under unix system (#5083)

* permanently remove cmdlets that are not supported under Unix and move tests to defaultcommands.tests.ps1
This commit is contained in:
Chunqing Chen
2017-11-10 10:36:08 -08:00
committed by Aditya Patwardhan
parent f5f3fab1ea
commit 2be13a623e
2 changed files with 30 additions and 30 deletions
@@ -4675,6 +4675,8 @@ end
new SessionStateAliasEntry("ps", "Get-Process"),
new SessionStateAliasEntry("rm", "Remove-Item"),
new SessionStateAliasEntry("rmdir", "Remove-Item"),
new SessionStateAliasEntry("cnsn", "Connect-PSSession", "", ReadOnly),
new SessionStateAliasEntry("dnsn", "Disconnect-PSSession", "", ReadOnly),
#endif
// Bash built-ins we purposefully keep even if they override native commands
new SessionStateAliasEntry("cd", "Set-Location", "", AllScope),
@@ -4731,8 +4733,6 @@ end
new SessionStateAliasEntry("ipsn", "Import-PSSession"),
new SessionStateAliasEntry("epsn", "Export-PSSession"),
#endif
new SessionStateAliasEntry("cnsn", "Connect-PSSession", "", ReadOnly),
new SessionStateAliasEntry("dnsn", "Disconnect-PSSession","", ReadOnly),
new SessionStateAliasEntry("nsn", "New-PSSession"),
new SessionStateAliasEntry("gsn", "Get-PSSession"),
new SessionStateAliasEntry("rsn", "Remove-PSSession"),
@@ -5367,18 +5367,27 @@ if($paths) {
{
{"Add-History", new SessionStateCmdletEntry("Add-History", typeof(AddHistoryCommand), helpFile) },
{"Clear-History", new SessionStateCmdletEntry("Clear-History", typeof(ClearHistoryCommand), helpFile) },
{"Connect-PSSession", new SessionStateCmdletEntry("Connect-PSSession", typeof(ConnectPSSessionCommand), helpFile) },
{"Debug-Job", new SessionStateCmdletEntry("Debug-Job", typeof(DebugJobCommand), helpFile) },
{"Disable-PSSessionConfiguration", new SessionStateCmdletEntry("Disable-PSSessionConfiguration", typeof(DisablePSSessionConfigurationCommand), helpFile) },
{"Disconnect-PSSession", new SessionStateCmdletEntry("Disconnect-PSSession", typeof(DisconnectPSSessionCommand), helpFile) },
#if !UNIX
{"Disable-PSRemoting", new SessionStateCmdletEntry("Disable-PSRemoting", typeof(DisablePSRemotingCommand), helpFile) },
{"Enable-PSRemoting", new SessionStateCmdletEntry("Enable-PSRemoting", typeof(EnablePSRemotingCommand), helpFile) },
{"Get-PSHostProcessInfo", new SessionStateCmdletEntry("Get-PSHostProcessInfo", typeof(GetPSHostProcessInfoCommand), helpFile) },
{"Enter-PSHostProcess", new SessionStateCmdletEntry("Enter-PSHostProcess", typeof(EnterPSHostProcessCommand), helpFile) },
{"Exit-PSHostProcess", new SessionStateCmdletEntry("Exit-PSHostProcess", typeof(ExitPSHostProcessCommand), helpFile) },
#endif
{"Disable-PSSessionConfiguration", new SessionStateCmdletEntry("Disable-PSSessionConfiguration", typeof(DisablePSSessionConfigurationCommand), helpFile) },
{"Enable-PSSessionConfiguration", new SessionStateCmdletEntry("Enable-PSSessionConfiguration", typeof(EnablePSSessionConfigurationCommand), helpFile) },
{"Get-PSSessionCapability", new SessionStateCmdletEntry("Get-PSSessionCapability", typeof(GetPSSessionCapabilityCommand), helpFile) },
{"Get-PSSessionConfiguration", new SessionStateCmdletEntry("Get-PSSessionConfiguration", typeof(GetPSSessionConfigurationCommand), helpFile) },
{"New-PSSessionConfigurationFile", new SessionStateCmdletEntry("New-PSSessionConfigurationFile", typeof(NewPSSessionConfigurationFileCommand), helpFile) },
{"New-PSSessionOption", new SessionStateCmdletEntry("New-PSSessionOption", typeof(NewPSSessionOptionCommand), helpFile) },
{"Receive-PSSession", new SessionStateCmdletEntry("Receive-PSSession", typeof(ReceivePSSessionCommand), helpFile) },
{"Register-PSSessionConfiguration", new SessionStateCmdletEntry("Register-PSSessionConfiguration", typeof(RegisterPSSessionConfigurationCommand), helpFile) },
{"Unregister-PSSessionConfiguration", new SessionStateCmdletEntry("Unregister-PSSessionConfiguration", typeof(UnregisterPSSessionConfigurationCommand), helpFile) },
{"Set-PSSessionConfiguration", new SessionStateCmdletEntry("Set-PSSessionConfiguration", typeof(SetPSSessionConfigurationCommand), helpFile) },
{"Test-PSSessionConfigurationFile", new SessionStateCmdletEntry("Test-PSSessionConfigurationFile", typeof(TestPSSessionConfigurationFileCommand), helpFile) },
{"Connect-PSSession", new SessionStateCmdletEntry("Connect-PSSession", typeof(ConnectPSSessionCommand), helpFile) },
{"Disconnect-PSSession", new SessionStateCmdletEntry("Disconnect-PSSession", typeof(DisconnectPSSessionCommand), helpFile) },
#endif
{"Enter-PSSession", new SessionStateCmdletEntry("Enter-PSSession", typeof(EnterPSSessionCommand), helpFile) },
{"Exit-PSSession", new SessionStateCmdletEntry("Exit-PSSession", typeof(ExitPSSessionCommand), helpFile) },
{"Export-ModuleMember", new SessionStateCmdletEntry("Export-ModuleMember", typeof(ExportModuleMemberCommand), helpFile) },
@@ -5389,8 +5398,6 @@ if($paths) {
{"Get-Job", new SessionStateCmdletEntry("Get-Job", typeof(GetJobCommand), helpFile) },
{"Get-Module", new SessionStateCmdletEntry("Get-Module", typeof(GetModuleCommand), helpFile) },
{"Get-PSSession", new SessionStateCmdletEntry("Get-PSSession", typeof(GetPSSessionCommand), helpFile) },
{"Get-PSSessionCapability", new SessionStateCmdletEntry("Get-PSSessionCapability", typeof(GetPSSessionCapabilityCommand), helpFile) },
{"Get-PSSessionConfiguration", new SessionStateCmdletEntry("Get-PSSessionConfiguration", typeof(GetPSSessionConfigurationCommand), helpFile) },
{"Import-Module", new SessionStateCmdletEntry("Import-Module", typeof(ImportModuleCommand), helpFile) },
{"Invoke-Command", new SessionStateCmdletEntry("Invoke-Command", typeof(InvokeCommandCommand), helpFile) },
{"Invoke-History", new SessionStateCmdletEntry("Invoke-History", typeof(InvokeHistoryCommand), helpFile) },
@@ -5398,28 +5405,21 @@ if($paths) {
{"New-ModuleManifest", new SessionStateCmdletEntry("New-ModuleManifest", typeof(NewModuleManifestCommand), helpFile) },
{"New-PSRoleCapabilityFile", new SessionStateCmdletEntry("New-PSRoleCapabilityFile", typeof(NewPSRoleCapabilityFileCommand), helpFile) },
{"New-PSSession", new SessionStateCmdletEntry("New-PSSession", typeof(NewPSSessionCommand), helpFile) },
{"New-PSSessionConfigurationFile", new SessionStateCmdletEntry("New-PSSessionConfigurationFile", typeof(NewPSSessionConfigurationFileCommand), helpFile) },
{"New-PSSessionOption", new SessionStateCmdletEntry("New-PSSessionOption", typeof(NewPSSessionOptionCommand), helpFile) },
{"New-PSTransportOption", new SessionStateCmdletEntry("New-PSTransportOption", typeof(NewPSTransportOptionCommand), helpFile) },
{"Out-Default", new SessionStateCmdletEntry("Out-Default", typeof(OutDefaultCommand), helpFile) },
{"Out-Host", new SessionStateCmdletEntry("Out-Host", typeof(OutHostCommand), helpFile) },
{"Out-Null", new SessionStateCmdletEntry("Out-Null", typeof(OutNullCommand), helpFile) },
{"Receive-Job", new SessionStateCmdletEntry("Receive-Job", typeof(ReceiveJobCommand), helpFile) },
{"Receive-PSSession", new SessionStateCmdletEntry("Receive-PSSession", typeof(ReceivePSSessionCommand), helpFile) },
{"Register-ArgumentCompleter", new SessionStateCmdletEntry("Register-ArgumentCompleter", typeof(RegisterArgumentCompleterCommand), helpFile) },
{"Register-PSSessionConfiguration", new SessionStateCmdletEntry("Register-PSSessionConfiguration", typeof(RegisterPSSessionConfigurationCommand), helpFile) },
{"Remove-Job", new SessionStateCmdletEntry("Remove-Job", typeof(RemoveJobCommand), helpFile) },
{"Remove-Module", new SessionStateCmdletEntry("Remove-Module", typeof(RemoveModuleCommand), helpFile) },
{"Remove-PSSession", new SessionStateCmdletEntry("Remove-PSSession", typeof(RemovePSSessionCommand), helpFile) },
{"Save-Help", new SessionStateCmdletEntry("Save-Help", typeof(SaveHelpCommand), helpFile) },
{"Set-PSDebug", new SessionStateCmdletEntry("Set-PSDebug", typeof(SetPSDebugCommand), helpFile) },
{"Set-PSSessionConfiguration", new SessionStateCmdletEntry("Set-PSSessionConfiguration", typeof(SetPSSessionConfigurationCommand), helpFile) },
{"Set-StrictMode", new SessionStateCmdletEntry("Set-StrictMode", typeof(SetStrictModeCommand), helpFile) },
{"Start-Job", new SessionStateCmdletEntry("Start-Job", typeof(StartJobCommand), helpFile) },
{"Stop-Job", new SessionStateCmdletEntry("Stop-Job", typeof(StopJobCommand), helpFile) },
{"Test-ModuleManifest", new SessionStateCmdletEntry("Test-ModuleManifest", typeof(TestModuleManifestCommand), helpFile) },
{"Test-PSSessionConfigurationFile", new SessionStateCmdletEntry("Test-PSSessionConfigurationFile", typeof(TestPSSessionConfigurationFileCommand), helpFile) },
{"Unregister-PSSessionConfiguration", new SessionStateCmdletEntry("Unregister-PSSessionConfiguration", typeof(UnregisterPSSessionConfigurationCommand), helpFile) },
{"Update-Help", new SessionStateCmdletEntry("Update-Help", typeof(UpdateHelpCommand), helpFile) },
{"Wait-Job", new SessionStateCmdletEntry("Wait-Job", typeof(WaitJobCommand), helpFile) },
{"Where-Object", new SessionStateCmdletEntry("Where-Object", typeof(WhereObjectCommand), helpFile) },
@@ -25,7 +25,7 @@ Describe "Verify approved aliases list" -Tags "CI" {
"Alias", "clp", "Clear-ItemProperty", $($FullCLR -or $CoreWindows -or $CoreUnix), "ReadOnly", ""
"Alias", "cls", "Clear-Host", $($FullCLR -or $CoreWindows -or $CoreUnix), "", ""
"Alias", "clv", "Clear-Variable", $($FullCLR -or $CoreWindows -or $CoreUnix), "ReadOnly", ""
"Alias", "cnsn", "Connect-PSSession", $($FullCLR -or $CoreWindows -or $CoreUnix), "ReadOnly", ""
"Alias", "cnsn", "Connect-PSSession", $($FullCLR -or $CoreWindows ), "ReadOnly", ""
"Alias", "compare", "Compare-Object", $($FullCLR -or $CoreWindows ), "ReadOnly", ""
"Alias", "copy", "Copy-Item", $($FullCLR -or $CoreWindows -or $CoreUnix), "", "AllScope"
"Alias", "cp", "Copy-Item", $($FullCLR -or $CoreWindows ), "", "AllScope"
@@ -37,7 +37,7 @@ Describe "Verify approved aliases list" -Tags "CI" {
"Alias", "del", "Remove-Item", $($FullCLR -or $CoreWindows -or $CoreUnix), "", "AllScope"
"Alias", "diff", "Compare-Object", $($FullCLR -or $CoreWindows ), "ReadOnly", ""
"Alias", "dir", "Get-ChildItem", $($FullCLR -or $CoreWindows -or $CoreUnix), "", "AllScope"
"Alias", "dnsn", "Disconnect-PSSession", $($FullCLR -or $CoreWindows -or $CoreUnix), "ReadOnly", ""
"Alias", "dnsn", "Disconnect-PSSession", $($FullCLR -or $CoreWindows ), "ReadOnly", ""
"Alias", "ebp", "Enable-PSBreakpoint", $($FullCLR -or $CoreWindows -or $CoreUnix), "ReadOnly", ""
"Alias", "echo", "Write-Output", $($FullCLR -or $CoreWindows -or $CoreUnix), "", "AllScope"
"Alias", "epal", "Export-Alias", $($FullCLR -or $CoreWindows -or $CoreUnix), "ReadOnly", ""
@@ -185,7 +185,7 @@ Describe "Verify approved aliases list" -Tags "CI" {
"Cmdlet", "Clear-Variable", , $($FullCLR -or $CoreWindows -or $CoreUnix)
"Cmdlet", "Compare-Object", , $($FullCLR -or $CoreWindows -or $CoreUnix)
"Cmdlet", "Complete-Transaction", , $($FullCLR )
"Cmdlet", "Connect-PSSession", , $($FullCLR -or $CoreWindows -or $CoreUnix)
"Cmdlet", "Connect-PSSession", , $($FullCLR -or $CoreWindows )
"Cmdlet", "Connect-WSMan", , $($FullCLR -or $CoreWindows )
"Cmdlet", "ConvertFrom-Csv", , $($FullCLR -or $CoreWindows -or $CoreUnix)
"Cmdlet", "ConvertFrom-Json", , $($FullCLR -or $CoreWindows -or $CoreUnix)
@@ -207,15 +207,15 @@ Describe "Verify approved aliases list" -Tags "CI" {
"Cmdlet", "Disable-ComputerRestore", , $($FullCLR )
"Cmdlet", "Disable-PSBreakpoint", , $($FullCLR -or $CoreWindows -or $CoreUnix)
"Cmdlet", "Disable-PSRemoting", , $($FullCLR -or $CoreWindows )
"Cmdlet", "Disable-PSSessionConfiguration", , $($FullCLR -or $CoreWindows -or $CoreUnix)
"Cmdlet", "Disable-PSSessionConfiguration", , $($FullCLR -or $CoreWindows )
"Cmdlet", "Disable-RunspaceDebug", , $($FullCLR -or $CoreWindows -or $CoreUnix)
"Cmdlet", "Disable-WSManCredSSP", , $($FullCLR -or $CoreWindows )
"Cmdlet", "Disconnect-PSSession", , $($FullCLR -or $CoreWindows -or $CoreUnix)
"Cmdlet", "Disconnect-PSSession", , $($FullCLR -or $CoreWindows )
"Cmdlet", "Disconnect-WSMan", , $($FullCLR -or $CoreWindows )
"Cmdlet", "Enable-ComputerRestore", , $($FullCLR )
"Cmdlet", "Enable-PSBreakpoint", , $($FullCLR -or $CoreWindows -or $CoreUnix)
"Cmdlet", "Enable-PSRemoting", , $($FullCLR -or $CoreWindows )
"Cmdlet", "Enable-PSSessionConfiguration", , $($FullCLR -or $CoreWindows -or $CoreUnix)
"Cmdlet", "Enable-PSSessionConfiguration", , $($FullCLR -or $CoreWindows )
"Cmdlet", "Enable-RunspaceDebug", , $($FullCLR -or $CoreWindows -or $CoreUnix)
"Cmdlet", "Enable-WSManCredSSP", , $($FullCLR -or $CoreWindows )
"Cmdlet", "Enter-PSHostProcess", , $($FullCLR -or $CoreWindows )
@@ -277,8 +277,8 @@ Describe "Verify approved aliases list" -Tags "CI" {
"Cmdlet", "Get-PSHostProcessInfo", , $($FullCLR -or $CoreWindows )
"Cmdlet", "Get-PSProvider", , $($FullCLR -or $CoreWindows -or $CoreUnix)
"Cmdlet", "Get-PSSession", , $($FullCLR -or $CoreWindows -or $CoreUnix)
"Cmdlet", "Get-PSSessionCapability", , $($FullCLR -or $CoreWindows -or $CoreUnix)
"Cmdlet", "Get-PSSessionConfiguration", , $($FullCLR -or $CoreWindows -or $CoreUnix)
"Cmdlet", "Get-PSSessionCapability", , $($FullCLR -or $CoreWindows )
"Cmdlet", "Get-PSSessionConfiguration", , $($FullCLR -or $CoreWindows )
"Cmdlet", "Get-PSSnapin", , $($FullCLR )
"Cmdlet", "Get-Random", , $($FullCLR -or $CoreWindows -or $CoreUnix)
"Cmdlet", "Get-Runspace", , $($FullCLR -or $CoreWindows -or $CoreUnix)
@@ -333,8 +333,8 @@ Describe "Verify approved aliases list" -Tags "CI" {
"Cmdlet", "New-PSDrive", , $($FullCLR -or $CoreWindows -or $CoreUnix)
"Cmdlet", "New-PSRoleCapabilityFile", , $( $CoreWindows -or $CoreUnix)
"Cmdlet", "New-PSSession", , $($FullCLR -or $CoreWindows -or $CoreUnix)
"Cmdlet", "New-PSSessionConfigurationFile", , $($FullCLR -or $CoreWindows -or $CoreUnix)
"Cmdlet", "New-PSSessionOption", , $($FullCLR -or $CoreWindows -or $CoreUnix)
"Cmdlet", "New-PSSessionConfigurationFile", , $($FullCLR -or $CoreWindows )
"Cmdlet", "New-PSSessionOption", , $($FullCLR -or $CoreWindows )
"Cmdlet", "New-PSTransportOption", , $($FullCLR -or $CoreWindows -or $CoreUnix)
"Cmdlet", "New-Service", , $($FullCLR -or $CoreWindows )
"Cmdlet", "New-TemporaryFile", , $( $CoreWindows -or $CoreUnix)
@@ -357,11 +357,11 @@ Describe "Verify approved aliases list" -Tags "CI" {
"Cmdlet", "Push-Location", , $($FullCLR -or $CoreWindows -or $CoreUnix)
"Cmdlet", "Read-Host", , $($FullCLR -or $CoreWindows -or $CoreUnix)
"Cmdlet", "Receive-Job", , $($FullCLR -or $CoreWindows -or $CoreUnix)
"Cmdlet", "Receive-PSSession", , $($FullCLR -or $CoreWindows -or $CoreUnix)
"Cmdlet", "Receive-PSSession", , $($FullCLR -or $CoreWindows )
"Cmdlet", "Register-ArgumentCompleter", , $($FullCLR -or $CoreWindows -or $CoreUnix)
"Cmdlet", "Register-EngineEvent", , $($FullCLR -or $CoreWindows -or $CoreUnix)
"Cmdlet", "Register-ObjectEvent", , $($FullCLR -or $CoreWindows -or $CoreUnix)
"Cmdlet", "Register-PSSessionConfiguration", , $($FullCLR -or $CoreWindows -or $CoreUnix)
"Cmdlet", "Register-PSSessionConfiguration", , $($FullCLR -or $CoreWindows )
"Cmdlet", "Register-WmiEvent", , $($FullCLR )
"Cmdlet", "Remove-Alias", , $( $CoreWindows -or $CoreUnix)
"Cmdlet", "Remove-Computer", , $($FullCLR )
@@ -407,7 +407,7 @@ Describe "Verify approved aliases list" -Tags "CI" {
"Cmdlet", "Set-Location", , $($FullCLR -or $CoreWindows -or $CoreUnix)
"Cmdlet", "Set-PSBreakpoint", , $($FullCLR -or $CoreWindows -or $CoreUnix)
"Cmdlet", "Set-PSDebug", , $($FullCLR -or $CoreWindows -or $CoreUnix)
"Cmdlet", "Set-PSSessionConfiguration", , $($FullCLR -or $CoreWindows -or $CoreUnix)
"Cmdlet", "Set-PSSessionConfiguration", , $($FullCLR -or $CoreWindows )
"Cmdlet", "Set-Service", , $($FullCLR -or $CoreWindows )
"Cmdlet", "Set-StrictMode", , $($FullCLR -or $CoreWindows -or $CoreUnix)
"Cmdlet", "Set-TimeZone", , $($FullCLR -or $CoreWindows )
@@ -439,14 +439,14 @@ Describe "Verify approved aliases list" -Tags "CI" {
"Cmdlet", "Test-FileCatalog", , $($FullCLR -or $CoreWindows )
"Cmdlet", "Test-ModuleManifest", , $($FullCLR -or $CoreWindows -or $CoreUnix)
"Cmdlet", "Test-Path", , $($FullCLR -or $CoreWindows -or $CoreUnix)
"Cmdlet", "Test-PSSessionConfigurationFile", , $($FullCLR -or $CoreWindows -or $CoreUnix)
"Cmdlet", "Test-PSSessionConfigurationFile", , $($FullCLR -or $CoreWindows )
"Cmdlet", "Test-WSMan", , $($FullCLR -or $CoreWindows )
"Cmdlet", "Trace-Command", , $($FullCLR -or $CoreWindows -or $CoreUnix)
"Cmdlet", "Unblock-File", , $($FullCLR -or $CoreWindows )
"Cmdlet", "Undo-Transaction", , $($FullCLR )
"Cmdlet", "Unprotect-CmsMessage", , $($FullCLR -or $CoreWindows )
"Cmdlet", "Unregister-Event", , $($FullCLR -or $CoreWindows -or $CoreUnix)
"Cmdlet", "Unregister-PSSessionConfiguration", , $($FullCLR -or $CoreWindows -or $CoreUnix)
"Cmdlet", "Unregister-PSSessionConfiguration", , $($FullCLR -or $CoreWindows )
"Cmdlet", "Update-FormatData", , $($FullCLR -or $CoreWindows -or $CoreUnix)
"Cmdlet", "Update-Help", , $($FullCLR -or $CoreWindows -or $CoreUnix)
"Cmdlet", "Update-List", , $($FullCLR )