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

CUT-4071: Get-JCSystemKB #602

Merged
merged 4 commits into from
Sep 10, 2024
Merged

Conversation

gweinjc
Copy link
Contributor

@gweinjc gweinjc commented Sep 9, 2024

Issues

What does this solve?

This introduces the Get-JCSystemKB function to the PowerShell module. With this function, an admin will be able to search their Windows devices for applied hotfixes/KBs. They will also have the added ability to filter for a specific KB as well as search individual devices

Is there anything particularly tricky?

The only tricky thing was creating the filter. In order to search multiple devices or hotfix_ids, the in operator must be used in the endpoint, however if you're only searching for a single device or hotfix_id, the eq operator must be used.

In order to solve for this I had to use a conditional to check if multiple values were inputted to the param via a comma separated array and then concat them together to form a valid string to be passed to the API

How should this be tested?

  1. Pull the branch locally and import the module
Import-Module /Users/USERNAME/Documents/GitHub/support/PowerShell/JumpCloud Module/JumpCloud.psd1 -force
Connect-JConline APIKEY -force
  1. Run the following commands and validate their output
# This should return all KBs in your organization
Get-JCSystemKB
# This should return all KBs for one device
$windowsDevice = Get-JCSystem -OS Windows | Select -First 1
Get-JCSystemKB -SystemID $windowsDevice._id
# This should return all KBs for one device using pipeline
$windowsDevice = Get-JCSystem -OS Windows | Select -First 1
$windowsDevice | Get-JCSystemKB
# This should return all devices that have that specific KB installed
$hotfix = Get-JCSystemKB | Select -First 1
Get-JCSystemKB -KB $hotfix.hotfix_id
# This should return one specific KB for one specific system
$hotfix = Get-JCSystemKB | Select -First 1
Get-JCSystemKB -KB $hotfix.hotfix_id -SystemID $hotfix.system_id

@gweinjc gweinjc added minor minor version release PowerShell Module Release for JumpCloud PowerShell Module labels Sep 9, 2024
@gweinjc gweinjc requested a review from a team as a code owner September 9, 2024 21:59
Copy link

@tonybjc tonybjc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, great comments as well. Thanks Geoff.

Copy link
Contributor

@kmaranionjc kmaranionjc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests and code looks good. Awesome work here!

@gweinjc gweinjc merged commit 8626883 into JumpCloudModule_2.14.0 Sep 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
minor minor version release PowerShell Module Release for JumpCloud PowerShell Module
Development

Successfully merging this pull request may close these issues.

3 participants