Skip to content

Disable cmdlets that are not supported under unix system - #5083

Merged
Aditya Patwardhan (adityapatwardhan) merged 3 commits into
PowerShell:masterfrom
chunqingchen:bugfix1
Nov 10, 2017
Merged

Disable cmdlets that are not supported under unix system#5083
Aditya Patwardhan (adityapatwardhan) merged 3 commits into
PowerShell:masterfrom
chunqingchen:bugfix1

Conversation

@chunqingchen

@chunqingchen Chunqing Chen (chunqingchen) commented Oct 11, 2017

Copy link
Copy Markdown
Contributor

resolve #4355

Removed cmdlets from IntialSessionState.cs so they will not be available on unix platforms.

@iSazonov

Copy link
Copy Markdown
Collaborator

Usually we exclude not ported cmdlets with #if !UNIX (or exclude whole file in csproj) and remove from psd1

Also we need correct tests in DefaultCommands.Tests.ps1

@chunqingchen

Copy link
Copy Markdown
Contributor Author

Ilya (@iSazonov) in issue #4355 you mentioned not implantation exception should be added instead of excluding the cmdlets. Is that not the case now?

@iSazonov

Copy link
Copy Markdown
Collaborator

Chunqing Chen (@chunqingchen) Sorry, my comment was not approved. I remember Dongbo Wang (@daxian-dbw) said that it is better exclude code in csproj - it is easy to track. Dongbo Wang (@daxian-dbw) Could you confirm?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra line added.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would ! Platform.IsWindows work?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For consistency sake, can we use non-windows path here?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For consistency sake, can we use non-windows path here?

@chunqingchen

Copy link
Copy Markdown
Contributor Author

Aditya Patwardhan (@adityapatwardhan) your comments are resolved.

@TravisEz13

Copy link
Copy Markdown
Member

The last commit is lot linked to a github account. Please resolve.

@adityapatwardhan

Copy link
Copy Markdown
Member

Chunqing Chen (@chunqingchen) The title and the description needs to be updated to match the implementation.

@chunqingchen Chunqing Chen (chunqingchen) changed the title add notimplementedException to cmdlets that are temporary not support… Disable cmdlets that are not supported under unix system Nov 1, 2017
@chunqingchen

Copy link
Copy Markdown
Contributor Author

public void LoadCommandStop(string Name) { WriteEvent(26, Name); }
}
}
} No newline at end of file

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add new line at EOF.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Chunqing Chen (@chunqingchen) Sorry, we should add newline after the last brace not before.

Test-Path Function:more | Should Be $true
}
}
} No newline at end of file

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add new line at EOF.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Chunqing Chen (@chunqingchen) Sorry, we should add newline after the last brace not before.

@chunqingchen

Copy link
Copy Markdown
Contributor Author

Ilya (@iSazonov) your comment is resolved

@iSazonov Ilya (iSazonov) left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leave a comment

Test-Path Function:more | Should Be $true
}
}
} No newline at end of file

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Chunqing Chen (@chunqingchen) Sorry, we should add newline after the last brace not before.

public void LoadCommandStop(string Name) { WriteEvent(26, Name); }
}
}
} No newline at end of file

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Chunqing Chen (@chunqingchen) Sorry, we should add newline after the last brace not before.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing newline

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing newline

@TravisEz13 Travis Plunk (TravisEz13) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix minor issue and it should be good

@chunqingchen

Copy link
Copy Markdown
Contributor Author

Travis Plunk (@TravisEz13) new line added.

@iSazonov Ilya (iSazonov) left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we exclude the code from compilation?

public void LoadCommandStart(string Name) { WriteEvent(25, Name); }
public void LoadCommandStop(string Name) { WriteEvent(26, Name); }
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please revert the formatting change and remove the line.

It "Should have 'more' as a function" {
Test-Path Function:more | Should Be $true
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please revert the formatting change and remove the line.

@adityapatwardhan

Copy link
Copy Markdown
Member

Chunqing Chen (@chunqingchen) Please run all tests using [Feature] in your git commit message.

https://github.com/PowerShell/PowerShell/blob/a1b7f8be3ea4ac7e4f7a67e6261ad68cdb23143d/docs/testing-guidelines/testing-guidelines.md#requesting-additional-tests-for-a-pr

@chunqingchen

Copy link
Copy Markdown
Contributor Author

Aditya Patwardhan (@adityapatwardhan) Ilya (@iSazonov) your comments are resolved. Thanks

@iSazonov

Ilya (iSazonov) commented Nov 8, 2017

Copy link
Copy Markdown
Collaborator

I believe the PR need #5379 to pass CI Appveyor.

@adityapatwardhan

Copy link
Copy Markdown
Member

Chunqing Chen (@chunqingchen) Can you have a look at the Travis CI failure?

@iSazonov

Copy link
Copy Markdown
Collaborator

CI Travis was passed but not reported.

@adityapatwardhan

Copy link
Copy Markdown
Member

Merging as CI has passed but webhook did not update status to GitHub.

@adityapatwardhan
Aditya Patwardhan (adityapatwardhan) merged commit 2be13a6 into PowerShell:master Nov 10, 2017
@vinodc

Copy link
Copy Markdown

Paul Allen (@paulcallen) Would you happen to know if New-PSSessionOption has been disabled? We updated to the latest version from 6.0.0 beta1 and this no longer works. It was previously working great and we have been using it with New-PSSessionOption since PowerShell/psl-omi-provider#67 was merged in.

@dantraMSFT

Copy link
Copy Markdown
Contributor

Vinod Chandru (@vinodc) I'll dig into this. For now, you can use [System.Management.Automation.Remoting.PSSessionOption]::new() and populate the returned object.

BTW: What's the use case you have for it on Linux. Perhaps it was missed with the cmdlet was removed.

@vinodc

Vinod Chandru (vinodc) commented Feb 22, 2018

Copy link
Copy Markdown

Dan Travison (@dantraMSFT) Thanks for the quick response. We are programmatically accessing Office 365 PowerShell cmdlets and in the process our code creates PSSessionOption objects. We can work around this temporarily, but wanted to make sure that the overall implementation itself is still supported for related commands used to connect to Office 365 PowerShell, starting with New-PSSessionOption.

On a broader note, this is related to piped commands failing (#6206), where we were recommended to update PowerShell first to see if we could reproduce the failure on the latest version, which resulted in these new issues coming up.

@dreyTee

Drey Tee (dreyTee) commented May 5, 2019

Copy link
Copy Markdown

Paul Allen (@paulcallen) Would you happen to know if New-PSSessionOption has been disabled?

Have same issue when trying to use WINRM from linux without proper server certificate:
Getting error:
Use the PSSessionOption -SkipCACheck and -SkipCNCheck
Trying to use thes options with New-PSSessionOption but can't:
New-PSSessionOption : The term 'New-PSSessionOption' is not recognized as the name of a cmdlet, function, script file, or operable program.
Please advise a workaround a least.

@iSazonov

Copy link
Copy Markdown
Collaborator

Drey Tee (@dreyTee) Please open new issue for your question.

Thatgfsj (Thatgfsj) pushed a commit to Thatgfsj/PowerShell that referenced this pull request Aug 6, 2026
…5083)

* permanently remove cmdlets that are not supported under Unix and move tests to defaultcommands.tests.ps1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Determine *-PSSession and *-PSSessionConfiguration Cmdlet Support Via OMI

7 participants