Add get policies command - #64
Open
chryzsh wants to merge 3 commits into
Open
Conversation
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.
Description
Adds
get policies, which retrieves and writes all machine policy assignments from a management point, including non-secret policies.The policy retrieval path now waits for each download to complete, handles download, decryption, XML parsing, and decompression failures per policy, decodes non-secret policy bodies as UTF-8, and removes nested XML declarations from decompressed content.
The PXE media-GUID flow remains supported by
get secretsonly. It was removed fromget policiesbecause that command does not implement the PXE flow.No new dependencies are required.
Type of Change
Testing
Test A: Ran
.\SharpSCCM_merged.exe get policies -o outagainst the test SCCM environment using an existing client for authentication. The command completed successfully and retrieved policy assignments and wrote them correctly to the specified output direcory.Test B: Ran the PXE authentication path using the media certificate, x64 unknown-machine GUID, and media GUID extracted from PXE media:
The command resolved the local management point and site code, retrieved 47 policy assignments, downloaded and decrypted the secret policy, and returned the expected Network Access Account credentials.
get secretbecause some of the code overlaps with that and found no breaking changes.Test Configuration:
Bonus Points:
Wiki documentation update is prepared separately:
chryzsh/SharpSCCM.wikibranchget-all-policies, commit596a944.A maintainer can apply it with:
Disclaimer: This code was initially generated with the assistance of AI. It has been manually guided, reviewed, and validated by me to ensure correctness, security, and alignment with project standards.