Add command data file for PowerShell v2 (needed to adapt script) #1091
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR Summary
When I demoed the
UseCompatibleCmdlets
rule at psday, I was being asked if there is an option for v2, so here it is.In order to produce the file (on WinServer 2009R2), I had to customise it (import all modules since lazy loading is not enabled, do not use
write-progress
, use the correct parameter set names forAdd-Member
, query all Snapins and produce an xml file instead due to lacking json support, etc.). The customised script is here: New-CommandDataFile.zipAfter running it and copying the produced xml file to a machine with powershell 5.1, I converted it to JSON as follows:
Import-Clixml .\desktop-2.0-windows.xml | ConvertTo-Json -Depth 4 | Out-File .\desktop-2.0-windows.json -Encoding utf8
I manually check with
ConvertFrom-Json
(which does not exist in v2) andWrite-Warning
(which does exist) that the JSON structure is still valid due to xml conversion.PR Checklist
.cs
,.ps1
and.psm1
files have the correct copyright headerWIP:
to the beginning of the title and remove the prefix when the PR is ready.