Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Examples should be fixed and amended #5623

Closed
mklement0 opened this issue Mar 21, 2020 · 1 comment
Closed

Examples should be fixed and amended #5623

mklement0 opened this issue Mar 21, 2020 · 1 comment
Assignees

Comments

@mklement0
Copy link
Contributor

@mklement0 mklement0 commented Mar 21, 2020

Get-WindowsFeature

Worth mentioning that this particular command is only available in server editions of Windows.

Perhaps a better example command is Get-AppLockerPolicy -Local, which implicitly imports the WinPS-only AppLocker module, which is also available on workstation editions (Windows 10).


'{"DisableImplicitWinCompat" : "False" should be: '{"DisableImplicitWinCompat" : true

That is, the logic is currently reversed (the example is about disabling), and the data type is (conceptually) incorrect.

Also, the example shows writing to a custom configuration file ("$PSHOME\DisableWinCompat.powershell.config.json"), that must be loaded explicitly via the CLI, with -settingsFile, and does so without explanation, which raises the following questions:

  • Is using a custom configuration file recommended?
  • Why not modify the standard "$PSHOME\powershell.config.json" file to disable by default?

$s = Get-PSSession -Name WinPSCompatSession
Invoke-Command -Session $s -ScriptBlock {"Running in Windows PowerShell version $($PSVersionTable.PSVersion)";<#Get-WinPSLiveObject | Set-WinPSLiveObject#>}

It looks like ;<#Get-WinPSLiveObject | Set-WinPSLiveObject#> was left in there by accident - otherwise, preferably, the example command needs to be amended to show an actual (two+-segment) pipeline.

Also, it should be mentioned that the example will only work if the background WinPS 5.1 session (named WinPSCompatSession) happens to have already been established in the session.

Unfortunately, there is currently no dedicated way to ensure that this session has already been created.

While running the example command suggested above (Get-AppLockerPolicy -Local) does - implicitly - create the session, the obvious side effect is that its module is imported (via the compatibility layer), which adds commands to the current session.


The topic is missing a few definite articles ("the"; was the topic authored by a native Russian speaker)?

you can use DisableImplicitWinCompat setting
or when PowerShell process exits.
imports this proxy module into current PowerShell session


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

@sdwheeler sdwheeler self-assigned this Mar 22, 2020
@sdwheeler

This comment has been minimized.

Copy link
Contributor

@sdwheeler sdwheeler commented Mar 22, 2020

Some of this I had already addressed in an unfinished PR. I added other changes based on this issue.

@sdwheeler sdwheeler mentioned this issue Mar 22, 2020
8 of 17 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

2 participants
You can’t perform that action at this time.