Add command data file for PowerShell v2 (needed to adapt script)#1091
Merged
bergmeister merged 3 commits intoPowerShell:developmentfrom Mar 5, 2019
Merged
Add command data file for PowerShell v2 (needed to adapt script)#1091bergmeister merged 3 commits intoPowerShell:developmentfrom
bergmeister merged 3 commits intoPowerShell:developmentfrom
Conversation
rjmholt
approved these changes
Mar 5, 2019
…nalyzer into commandData_v2 # Conflicts: # RuleDocumentation/UseCompatibleCmdlets.md
bergmeister
added a commit
to bergmeister/PSScriptAnalyzer
that referenced
this pull request
Mar 22, 2019
…erShell#1091) * add command data file for v2 (needed to adapt script) * trigger ci
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
UseCompatibleCmdletsrule 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 utf8I 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,.ps1and.psm1files have the correct copyright headerWIP:to the beginning of the title and remove the prefix when the PR is ready.