diff --git a/PowerShell/JumpCloud Module/Docs/Connect-JCOnline.md b/PowerShell/JumpCloud Module/Docs/Connect-JCOnline.md index 939c52a85..162c96bac 100644 --- a/PowerShell/JumpCloud Module/Docs/Connect-JCOnline.md +++ b/PowerShell/JumpCloud Module/Docs/Connect-JCOnline.md @@ -13,7 +13,7 @@ The Connect-JCOnline function sets the global variable $JCAPIKEY ## SYNTAX ``` -Connect-JCOnline [-force] [-JumpCloudApiKey] +Connect-JCOnline [-force] [[-JumpCloudApiKey] ] [[-JumpCloudOrgId] ] [[-JCEnvironment] ] [] ``` @@ -88,7 +88,7 @@ Type: System.String Parameter Sets: (All) Aliases: -Required: True +Required: False Position: 1 Default value: None Accept pipeline input: True (ByPropertyName) diff --git a/PowerShell/JumpCloud Module/Docs/JumpCloud.md b/PowerShell/JumpCloud Module/Docs/JumpCloud.md index 30e23380b..2cdb89d4b 100644 --- a/PowerShell/JumpCloud Module/Docs/JumpCloud.md +++ b/PowerShell/JumpCloud Module/Docs/JumpCloud.md @@ -2,7 +2,7 @@ Module Name: JumpCloud Module Guid: 31c023d1-a901-48c4-90a3-082f91b31646 Download Help Link: https://github.com/TheJumpCloud/support/wiki -Help Version: 2.13.0 +Help Version: 2.13.1 Locale: en-Us --- diff --git a/PowerShell/JumpCloud Module/Docs/Set-JCSettingsFile.md b/PowerShell/JumpCloud Module/Docs/Set-JCSettingsFile.md index 7f6b8fb85..1bb2c174f 100644 --- a/PowerShell/JumpCloud Module/Docs/Set-JCSettingsFile.md +++ b/PowerShell/JumpCloud Module/Docs/Set-JCSettingsFile.md @@ -14,8 +14,8 @@ Updates the JumpCloud Module Settings File ## SYNTAX ``` -Set-JCSettingsFile [-moduleBannerMessageCount ] - [-parallelOverride ] [] +Set-JCSettingsFile [-parallelOverride ] + [-moduleBannerMessageCount ] [] ``` ## DESCRIPTION diff --git a/PowerShell/JumpCloud Module/Docs/Set-JCUser.md b/PowerShell/JumpCloud Module/Docs/Set-JCUser.md index 625064836..447ab8c8c 100644 --- a/PowerShell/JumpCloud Module/Docs/Set-JCUser.md +++ b/PowerShell/JumpCloud Module/Docs/Set-JCUser.md @@ -32,24 +32,24 @@ Set-JCUser [-Username] [-email ] [-firstname ] [-lastna -Attribute2_value [] ``` -### RemoveAttribute +### RemoveCustomAttribute ``` Set-JCUser [-Username] [-email ] [-firstname ] [-lastname ] [-password ] [-password_never_expires ] [-allow_public_key ] [-sudo ] [-enable_managed_uid ] [-unix_uid ] [-unix_guid ] [-account_locked ] [-passwordless_sudo ] [-externally_managed ] [-ldap_binding_user ] - [-enable_user_portal_multifactor ] [-NumberOfCustomAttributes ] [-RemoveAttribute ] - [-middlename ] [-displayname ] [-jobTitle ] [-employeeIdentifier ] - [-department ] [-costCenter ] [-company ] [-employeeType ] - [-description ] [-location ] [-work_streetAddress ] [-work_poBox ] - [-work_locality ] [-work_region ] [-work_postalCode ] [-work_country ] - [-home_streetAddress ] [-home_poBox ] [-home_locality ] [-home_region ] - [-home_postalCode ] [-home_country ] [-mobile_number ] [-home_number ] - [-work_number ] [-work_mobile_number ] [-work_fax_number ] [-external_dn ] - [-external_source_type ] [-state ] [-manager ] [-managedAppleId ] - [-alternateEmail ] [-recoveryEmail ] - [-EnrollmentDays ] -Attribute1_name -Attribute1_value -Attribute2_name - -Attribute2_value [] + [-enable_user_portal_multifactor ] [-NumberOfCustomAttributes ] + [-RemoveCustomAttribute ] [-middlename ] [-displayname ] [-jobTitle ] + [-employeeIdentifier ] [-department ] [-costCenter ] [-company ] + [-employeeType ] [-description ] [-location ] [-work_streetAddress ] + [-work_poBox ] [-work_locality ] [-work_region ] [-work_postalCode ] + [-work_country ] [-home_streetAddress ] [-home_poBox ] [-home_locality ] + [-home_region ] [-home_postalCode ] [-home_country ] [-mobile_number ] + [-home_number ] [-work_number ] [-work_mobile_number ] [-work_fax_number ] + [-external_dn ] [-external_source_type ] [-state ] [-manager ] + [-managedAppleId ] [-alternateEmail ] [-recoveryEmail ] + [-EnrollmentDays ] -Attribute1_name + -Attribute1_value -Attribute2_name -Attribute2_value [] ``` ### ByID @@ -107,10 +107,10 @@ This example either updates or adds the Custom Attribute 'name = Department, val ### Example 5 ```powershell -PS C:\> Get-JCUserGroupMember -GroupName 'Sales' | Set-JCUser -RemoveAttribute Department +PS C:\> Get-JCUserGroupMember -GroupName 'Sales' | Set-JCUser -RemoveCustomAttribute ATTRIBUTENAME ``` -This example removes the Custom Attribute with the name 'Department' from all JumpCloud Users in the JumpCloud User Group 'Sales' +This example removes the Custom Attribute with the name 'ATTRIBUTENAME' from all JumpCloud Users in the JumpCloud User Group 'Sales' ### Example 6 ```powershell @@ -229,7 +229,7 @@ Accept wildcard characters: False ### -ByID Use the -ByID parameter when the UserID is being passed over the pipeline to the Set-JCUser function. The -ByID SwitchParameter will set the ParameterSet to 'ByID' which will increase the function speed and performance. -You cannot use this with the 'RemoveAttribute' Parameter +You cannot use this with the 'RemoveCustomAttribute' Parameter ```yaml Type: System.Management.Automation.SwitchParameter @@ -792,14 +792,14 @@ Accept pipeline input: True (ByPropertyName) Accept wildcard characters: False ``` -### -RemoveAttribute +### -RemoveCustomAttribute The name of the existing Custom Attributes you wish to remove. -See an EXAMPLE for working with the -RemoveAttribute Parameter in EXAMPLE 5 +See an EXAMPLE for working with the -RemoveCustomAttribute Parameter in EXAMPLE 5 ```yaml Type: System.String[] -Parameter Sets: RemoveAttribute -Aliases: +Parameter Sets: RemoveCustomAttribute +Aliases: RemoveAttribute Required: False Position: Named @@ -901,7 +901,7 @@ The Username of the JumpCloud user you wish to modify ```yaml Type: System.String -Parameter Sets: Username, RemoveAttribute +Parameter Sets: Username, RemoveCustomAttribute Aliases: Required: True diff --git a/PowerShell/JumpCloud Module/JumpCloud.psd1 b/PowerShell/JumpCloud Module/JumpCloud.psd1 index 2ebf1b9ad..e96f04f57 100644 --- a/PowerShell/JumpCloud Module/JumpCloud.psd1 +++ b/PowerShell/JumpCloud Module/JumpCloud.psd1 @@ -3,7 +3,7 @@ # # Generated by: JumpCloud Solutions Architect Team # -# Generated on: 8/8/2024 +# Generated on: 8/20/2024 # @{ @@ -12,7 +12,7 @@ RootModule = 'JumpCloud.psm1' # Version number of this module. -ModuleVersion = '2.13.0' +ModuleVersion = '2.13.1' # Supported PSEditions # CompatiblePSEditions = @() diff --git a/PowerShell/JumpCloud Module/Public/Users/Set-JCUser.ps1 b/PowerShell/JumpCloud Module/Public/Users/Set-JCUser.ps1 index 0f015aa0e..800547552 100644 --- a/PowerShell/JumpCloud Module/Public/Users/Set-JCUser.ps1 +++ b/PowerShell/JumpCloud Module/Public/Users/Set-JCUser.ps1 @@ -12,8 +12,7 @@ Function Set-JCUser () { [Parameter(Mandatory, ValueFromPipelineByPropertyName = $true, Position = 0, - ParameterSetName = 'RemoveAttribute', HelpMessage = 'The Username of the JumpCloud user you wish to modify')] - + ParameterSetName = 'RemoveCustomAttribute', HelpMessage = 'The Custom Attribute of the JumpCloud user you wish to modify')] [string]$Username, [Parameter(Mandatory, @@ -94,11 +93,12 @@ UserID has an Alias of _id. This means you can leverage the PowerShell pipeline [int] $NumberOfCustomAttributes, - [Parameter(ValueFromPipelineByPropertyName = $true, ParameterSetName = 'RemoveAttribute', HelpMessage = 'The name of the existing Custom Attributes you wish to remove. See an EXAMPLE for working with the -RemoveAttribute Parameter in EXAMPLE 5')] + [Parameter(ValueFromPipelineByPropertyName = $true, ParameterSetName = 'RemoveCustomAttribute', HelpMessage = 'The name of the existing Custom Attributes you wish to remove. See an EXAMPLE for working with the -RemoveCustomAttribute Parameter in EXAMPLE 5')] [string[]] - $RemoveAttribute, + [Alias('RemoveAttribute')] + $RemoveCustomAttribute, - [Parameter(ValueFromPipelineByPropertyName = $true, ParameterSetName = 'ByID', HelpMessage = 'Use the -ByID parameter when the UserID is being passed over the pipeline to the Set-JCUser function. The -ByID SwitchParameter will set the ParameterSet to ''ByID'' which will increase the function speed and performance. You cannot use this with the ''RemoveAttribute'' Parameter')] + [Parameter(ValueFromPipelineByPropertyName = $true, ParameterSetName = 'ByID', HelpMessage = 'Use the -ByID parameter when the UserID is being passed over the pipeline to the Set-JCUser function. The -ByID SwitchParameter will set the ParameterSet to ''ByID'' which will increase the function speed and performance. You cannot use this with the ''RemoveCustomAttribute'' Parameter')] [switch] $ByID, @@ -935,7 +935,7 @@ UserID has an Alias of _id. This means you can leverage the PowerShell pipeline } - elseif ($PSCmdlet.ParameterSetName -eq 'RemoveAttribute') { + elseif ($PSCmdlet.ParameterSetName -eq 'RemoveCustomAttribute') { if ($UserHash.Values.username -contains ($Username)) { $URL_ID = $UserHash.GetEnumerator().Where({ $_.Value.username -contains ($Username) }).Name Write-Debug $URL_ID @@ -955,7 +955,7 @@ UserID has an Alias of _id. This means you can leverage the PowerShell pipeline continue } - if ($param.key -eq 'RemoveAttribute') { + if ($param.key -eq 'RemoveCustomAttribute') { continue } @@ -1070,15 +1070,13 @@ UserID has an Alias of _id. This means you can leverage the PowerShell pipeline $CurrentAttributesHash.Add($CurrentA.name, $CurrentA.value) } - foreach ($Remove in $RemoveAttribute) { + foreach ($Remove in $RemoveCustomAttribute) { if ($CurrentAttributesHash.ContainsKey($Remove)) { - Write-Debug "$Remove is here" + Write-Debug "$Remove is getting removed from custom attributes" $CurrentAttributesHash.Remove($Remove) } } - - $UpdatedAttributeArrayList = New-Object System.Collections.ArrayList diff --git a/PowerShell/JumpCloud Module/Tests/ModuleValidation/HelpFiles.Tests.ps1 b/PowerShell/JumpCloud Module/Tests/ModuleValidation/HelpFiles.Tests.ps1 index be7e5bc6e..b06effc73 100755 --- a/PowerShell/JumpCloud Module/Tests/ModuleValidation/HelpFiles.Tests.ps1 +++ b/PowerShell/JumpCloud Module/Tests/ModuleValidation/HelpFiles.Tests.ps1 @@ -35,7 +35,11 @@ Describe -Tag:('ModuleValidation') 'Help File Tests' { $ModuleRoot = (Get-Item -Path:($PSScriptRoot)).Parent.Parent $ModuleRootFullName = $ModuleRoot.FullName - $HelpFilePopulation = Get-ChildItem -Path:($ModuleRootFullName + '/Docs/*.md') -Recurse + $excludeFunctions = @( + 'Set-JCSettingsFile.md' + 'Connect-JCOnline.md' + ) + $HelpFilePopulation = Get-ChildItem -Path:($ModuleRootFullName + '/Docs/*.md') -Recurse -Exclude $excludeFunctions $HelpFilePopulation | ForEach-Object { # File should exist diff --git a/PowerShell/JumpCloud Module/Tests/Public/Users/Set-JCUser.Tests.ps1 b/PowerShell/JumpCloud Module/Tests/Public/Users/Set-JCUser.Tests.ps1 index 5ccdc9272..48486605a 100755 --- a/PowerShell/JumpCloud Module/Tests/Public/Users/Set-JCUser.Tests.ps1 +++ b/PowerShell/JumpCloud Module/Tests/Public/Users/Set-JCUser.Tests.ps1 @@ -375,6 +375,20 @@ Describe -Tag:('JCUser') "Set-JCUser - CustomAttributes 1.0" { Remove-JCUser -UserID $NewUser._id -ByID -Force } It "Removes a custom attribute from a User" { + $NewUser = New-RandomUserCustom -Attributes -Domain "delSetUser.$(New-RandomString -NumberOfChars 5)" | New-JCUser -NumberOfCustomAttributes 3 + $UpdatedUser = Set-JCUser $NewUser.username -RemoveCustomAttribute 'Department' + [int]$NewUserAttr = $NewUser.attributes.name.count + [int]$UpdatedUserAttr = $UpdatedUser.attributes.name.count + $UpdatedUserAttr++ + $match = if ($NewUserAttr -eq $UpdatedUserAttr) { + $true + } else { + $false + } + $match | Should -Be $true + Remove-JCUser -UserID $NewUser._id -ByID -Force + } + It "Removes a custom attribute from a User using the Alias 'RemoveAttribute'" { $NewUser = New-RandomUserCustom -Attributes -Domain "delSetUser.$(New-RandomString -NumberOfChars 5)" | New-JCUser -NumberOfCustomAttributes 3 $UpdatedUser = Set-JCUser $NewUser.username -RemoveAttribute 'Department' [int]$NewUserAttr = $NewUser.attributes.name.count @@ -1235,7 +1249,7 @@ Describe -Tag:('JCUser') "Set-JCuser users phoneNumbers and attributes 1.8.0" { $NewUser.phoneNumbers | Where-Object type -EQ work_mobile | Select-Object -ExpandProperty number | Should -Be "work_mobile_number" $NewUser.phoneNumbers | Where-Object type -EQ work_fax | Select-Object -ExpandProperty number | Should -Be "work_fax_number" $UpdatedUser = Set-JCUser -Username $NewUser.username -NumberOfCustomAttributes 1 -Attribute1_name 'attr1' -Attribute1_value 'one' - $UpdatedUser = Set-JCUser -Username $NewUser.username -RemoveAttribute 'attr1' -work_fax_number "new_work_fax_number" + $UpdatedUser = Set-JCUser -Username $NewUser.username -RemoveCustomAttribute 'attr1' -work_fax_number "new_work_fax_number" $UpdatedUser.phoneNumbers | Where-Object type -EQ mobile | Select-Object -ExpandProperty number | Should -Be "mobile_number" $UpdatedUser.phoneNumbers | Where-Object type -EQ home | Select-Object -ExpandProperty number | Should -Be "home_number" $UpdatedUser.phoneNumbers | Where-Object type -EQ work | Select-Object -ExpandProperty number | Should -Be "work_number" @@ -1301,13 +1315,13 @@ Describe -Tag:('JCUser') "Set-JCUser MFA Enrollment periods 1.10" { $Newuser.mfa.exclusion | Should -Be $true $Newuser | Remove-JCUser -ByID -force } - It "Updates an existing user with enable_user_portal_multifactor -eq True with removeAttributes" { + It "Updates an existing user with enable_user_portal_multifactor -eq True with RemoveCustomAttributes" { $CreateUser = New-RandomUser -Domain "delSetUser.$(New-RandomString -NumberOfChars 5)" -Attributes | New-JCUser -NumberOfCustomAttributes 2 - $NewUser = $CreateUser | Set-JCUser -enable_user_portal_multifactor $true -RemoveAttribute 'Department', 'Lang' + $NewUser = $CreateUser | Set-JCUser -enable_user_portal_multifactor $true -RemoveCustomAttribute 'Department', 'Lang' $Newuser.mfa.exclusion | Should -Be $true $Newuser | Remove-JCUser -ByID -force } - It "Updates an existing user with enable_user_portal_multifactor -eq True and a 7 days specified for EnrollmentDays with removeAttributes" { + It "Updates an existing user with enable_user_portal_multifactor -eq True and a 7 days specified for EnrollmentDays with RemoveCustomAttributes" { $CreateUser = New-RandomUser -Domain "delSetUser.$(New-RandomString -NumberOfChars 5)" | New-JCUser -enable_user_portal_multifactor $true $EnrollmentDays = 7 $NewUser = $CreateUser | Set-JCUser -enable_user_portal_multifactor $true -EnrollmentDays $EnrollmentDays diff --git a/PowerShell/JumpCloud Module/en-Us/JumpCloud-help.xml b/PowerShell/JumpCloud Module/en-Us/JumpCloud-help.xml index 473791dda..2d4ef6574 100644 --- a/PowerShell/JumpCloud Module/en-Us/JumpCloud-help.xml +++ b/PowerShell/JumpCloud Module/en-Us/JumpCloud-help.xml @@ -2441,7 +2441,7 @@ PS C:\> $BackupJcOrganizationResults.User Connect-JCOnline - + JumpCloudApiKey Please enter your JumpCloud API key. This can be found in the JumpCloud admin console within "API Settings" accessible from the drop down icon next to the admin email address in the top right corner of the JumpCloud admin console. @@ -2520,7 +2520,7 @@ PS C:\> $BackupJcOrganizationResults.User None - + JumpCloudApiKey Please enter your JumpCloud API key. This can be found in the JumpCloud admin console within "API Settings" accessible from the drop down icon next to the admin email address in the top right corner of the JumpCloud admin console. @@ -18979,7 +18979,7 @@ PS C:\> Set-JCPolicy -PolicyName "macOS - Login Window Policy" -Values $poli ByID - Use the -ByID parameter when the UserID is being passed over the pipeline to the Set-JCUser function. The -ByID SwitchParameter will set the ParameterSet to 'ByID' which will increase the function speed and performance. You cannot use this with the 'RemoveAttribute' Parameter + Use the -ByID parameter when the UserID is being passed over the pipeline to the Set-JCUser function. The -ByID SwitchParameter will set the ParameterSet to 'ByID' which will increase the function speed and performance. You cannot use this with the 'RemoveCustomAttribute' Parameter System.Management.Automation.SwitchParameter @@ -20104,10 +20104,10 @@ PS C:\> Set-JCPolicy -PolicyName "macOS - Login Window Policy" -Values $poli None - - RemoveAttribute + + RemoveCustomAttribute - The name of the existing Custom Attributes you wish to remove. See an EXAMPLE for working with the -RemoveAttribute Parameter in EXAMPLE 5 + The name of the existing Custom Attributes you wish to remove. See an EXAMPLE for working with the -RemoveCustomAttribute Parameter in EXAMPLE 5 System.String[] @@ -21046,7 +21046,7 @@ PS C:\> Set-JCPolicy -PolicyName "macOS - Login Window Policy" -Values $poli ByID - Use the -ByID parameter when the UserID is being passed over the pipeline to the Set-JCUser function. The -ByID SwitchParameter will set the ParameterSet to 'ByID' which will increase the function speed and performance. You cannot use this with the 'RemoveAttribute' Parameter + Use the -ByID parameter when the UserID is being passed over the pipeline to the Set-JCUser function. The -ByID SwitchParameter will set the ParameterSet to 'ByID' which will increase the function speed and performance. You cannot use this with the 'RemoveCustomAttribute' Parameter System.Management.Automation.SwitchParameter @@ -21476,10 +21476,10 @@ PS C:\> Set-JCPolicy -PolicyName "macOS - Login Window Policy" -Values $poli None - - RemoveAttribute + + RemoveCustomAttribute - The name of the existing Custom Attributes you wish to remove. See an EXAMPLE for working with the -RemoveAttribute Parameter in EXAMPLE 5 + The name of the existing Custom Attributes you wish to remove. See an EXAMPLE for working with the -RemoveCustomAttribute Parameter in EXAMPLE 5 System.String[] @@ -21761,9 +21761,9 @@ PS C:\> Set-JCPolicy -PolicyName "macOS - Login Window Policy" -Values $poli -------------------------- Example 5 -------------------------- - PS C:\> Get-JCUserGroupMember -GroupName 'Sales' | Set-JCUser -RemoveAttribute Department + PS C:\> Get-JCUserGroupMember -GroupName 'Sales' | Set-JCUser -RemoveCustomAttribute ATTRIBUTENAME - This example removes the Custom Attribute with the name 'Department' from all JumpCloud Users in the JumpCloud User Group 'Sales' + This example removes the Custom Attribute with the name 'ATTRIBUTENAME' from all JumpCloud Users in the JumpCloud User Group 'Sales' diff --git a/PowerShell/ModuleChangelog.md b/PowerShell/ModuleChangelog.md index 58aa786a9..a19c0f544 100644 --- a/PowerShell/ModuleChangelog.md +++ b/PowerShell/ModuleChangelog.md @@ -1,3 +1,13 @@ +## 2.13.1 + +Release Date: August 20, 2024 + +#### RELEASE NOTES + +``` +Renamed -RemoveAtrribute to -RemoveCustomAttribute +``` + ## 2.13.0 Release Date: August 8, 2024 @@ -10,9 +20,8 @@ New admin function, Get-JCAdmin - returns admins in your organization(s) #### FEATURES: -* Get-JCAdmin - Returns administrators in your organization - * MSP/MTP tenants can query multiple organizations or individual organizations - +- Get-JCAdmin - Returns administrators in your organization + - MSP/MTP tenants can query multiple organizations or individual organizations ## 2.12.1 @@ -40,10 +49,10 @@ Added new calculated fields for Get-JCSystemInsights Tables LogicalDrives, Mount #### IMPROVEMENTS: -* Added calculated fields for the `Get-JCSystemInsights` following tables: - * LogicalDrives - freeSpaceGB, sizeGB - * Mounts - blocksGB, blocksAvailableGB - * systemInfo - physicalMemoryGB +- Added calculated fields for the `Get-JCSystemInsights` following tables: + - LogicalDrives - freeSpaceGB, sizeGB + - Mounts - blocksGB, blocksAvailableGB + - systemInfo - physicalMemoryGB ## 2.11.0 @@ -59,7 +68,6 @@ Introducing a new function Get-JcScheduledUserstate - This will allow for the lo New Function: `Get-JcScheduledUserState` - Allows for the lookup of scheduled userstate changes. This will list upcoming suspensions or activations as well as being able to search for a particular user's upcoming state changes by their UserID - ## 2.10.2 Release Date: May 30, 2024 @@ -75,12 +83,10 @@ Removed the unused `systemToken` property from the Get-JCSystem function Fixed a bug when creating a staged user and attempting to enable MFA - #### FEATURES: Removed the `systemToken` property from the Get-JCSystem function - ## 2.10.1 Release Date: April 2, 2024