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

Add command data file for PowerShell v2 (needed to adapt script) #1091

Merged
merged 3 commits into from
Mar 5, 2019

Conversation

bergmeister
Copy link
Collaborator

@bergmeister bergmeister commented Nov 2, 2018

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 for Add-Member, query all Snapins and produce an xml file instead due to lacking json support, etc.). The customised script is here: New-CommandDataFile.zip
After 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) and Write-Warning (which does exist) that the JSON structure is still valid due to xml conversion.

PR Checklist

@bergmeister bergmeister added the (Re-)Review Needed Feedback has been addressed during PR stage or is required in the first place. label Jan 29, 2019
…nalyzer into commandData_v2

# Conflicts:
#	RuleDocumentation/UseCompatibleCmdlets.md
@bergmeister bergmeister merged commit e592dc4 into PowerShell:development Mar 5, 2019
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area - Engine Area - Rules (Re-)Review Needed Feedback has been addressed during PR stage or is required in the first place.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants