Skip to content

Commit

Permalink
Merge branch 'CUT-4394_JCDeviceFromCSV' into CUT-4468-Cascade-Manager…
Browse files Browse the repository at this point in the history
…-Remove-JCUser
  • Loading branch information
kmaranionjc authored Dec 17, 2024
2 parents 67501fa + 4400a83 commit d86b6e2
Show file tree
Hide file tree
Showing 18 changed files with 961 additions and 73 deletions.
6 changes: 6 additions & 0 deletions PowerShell/JumpCloud Module/Docs/JumpCloud.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,9 @@ Creates a new JumpCloud Mac, Linux, or Windows command
### [New-JCDeploymentTemplate](New-JCDeploymentTemplate.md)
A guided walk through that creates a command deployment CSV file on your local machine.

### [New-JCDeviceUpdateTemplate](New-JCDeviceUpdateTemplate.md)
A guided walk through that creates a JumpCloud Device Import CSV file on your local machine.

### [New-JCImportTemplate](New-JCImportTemplate.md)
A guided walk through that creates a JumpCloud User Import CSV file on your local machine.

Expand Down Expand Up @@ -284,6 +287,9 @@ Updates an existing JumpCloud User
### [Set-JCUserGroupLDAP](Set-JCUserGroupLDAP.md)
The Set-JCUserGroupLDAP command adds or removes a JumpCloud user group and the members to/from the JumpCloud LDAP directory.

### [Update-JCDeviceFromCSV](Update-JCDeviceFromCSV.md)
Updates a set of JumpCloud devices from a CSV file created using the New-JCDeviceUpdateTemplate function.

### [Update-JCModule](Update-JCModule.md)
Running this function will trigger the update of the JumpCloud PowerShell module.

Expand Down
60 changes: 60 additions & 0 deletions PowerShell/JumpCloud Module/Docs/New-JCDeviceUpdateTemplate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
---
external help file: JumpCloud-help.xml
Module Name: JumpCloud
online version: https://github.com/TheJumpCloud/support/wiki/
schema: 2.0.0
---

# New-JCDeviceUpdateTemplate

## SYNOPSIS
A guided walk through that creates a JumpCloud Device Import CSV file on your local machine.

## SYNTAX

```
New-JCDeviceUpdateTemplate [-Force] [<CommonParameters>]
```

## DESCRIPTION
The New-JCDeviceUpdateTemplate command is a menu driven function that guides end users and creates a custom JumpCloud Device Import .CSV file on their machine for populating with their Device information for updating in JumpCloud.

## EXAMPLES

### Example 1
```powershell
PS C:\> New-JCDeviceUpdateTemplate
```

Launches the New-JCDeviceUpdateTemplate menu

## PARAMETERS

### -Force
Parameter to force populate CSV with all headers when creating an update template.
When selected this option will forcefully replace existing files in the current working directory

```yaml
Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
## INPUTS
### None
## OUTPUTS
### System.Object
## NOTES
## RELATED LINKS
4 changes: 2 additions & 2 deletions PowerShell/JumpCloud Module/Docs/Set-JCSettingsFile.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ Updates the JumpCloud Module Settings File
## SYNTAX

```
Set-JCSettingsFile [-parallelOverride <PSObject>]
[-moduleBannerMessageCount <PSObject>] [<CommonParameters>]
Set-JCSettingsFile [-moduleBannerMessageCount <PSObject>]
[-parallelOverride <PSObject>] [<CommonParameters>]
```

## DESCRIPTION
Expand Down
89 changes: 89 additions & 0 deletions PowerShell/JumpCloud Module/Docs/Update-JCDeviceFromCSV.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
---
external help file: JumpCloud-help.xml
Module Name: JumpCloud
online version: https://github.com/TheJumpCloud/support/wiki/
schema: 2.0.0
---

# Update-JCDeviceFromCSV

## SYNOPSIS
Updates a set of JumpCloud devices from a CSV file created using the New-JCDeviceUpdateTemplate function.

## SYNTAX

### GUI (Default)
```
Update-JCDeviceFromCSV [-CSVFilePath] <String> [<CommonParameters>]
```

### force
```
Update-JCDeviceFromCSV [-CSVFilePath] <String> [-force]
[<CommonParameters>]
```

## DESCRIPTION
The Update-JCDeviceFromCSV bulk sets device attributes via a CSV input.

## EXAMPLES

### Example 1
```powershell
PS C:\> Update-JCDeviceFromCSV ./JCDeviceUpdateImport_12-11-2024.csv
```

Updates devices from the .csv file 'JCDeviceUpdateImport_12-11-2024.csv'

### Example 2
```powershell
PS C:\> Update-JCDeviceFromCSV ./JCDeviceUpdateImport_12-11-2024.csv -Force
```

Uses the 'Force' parameter to skip the GUI and update devices from the file 'JCDeviceUpdateImport_12-11-2024.csv'

## PARAMETERS

### -CSVFilePath
The full path to the CSV file you wish to import.
You can use tab complete to search for .csv files.

```yaml
Type: System.String
Parameter Sets: (All)
Aliases:

Required: True
Position: 0
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -force
A SwitchParameter which suppresses the GUI and data validation when using the Update-JCDeviceFromCSV command.
```yaml
Type: System.Management.Automation.SwitchParameter
Parameter Sets: force
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
## INPUTS
### None
## OUTPUTS
### System.Object
## NOTES
## RELATED LINKS
124 changes: 63 additions & 61 deletions PowerShell/JumpCloud Module/JumpCloud.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -3,40 +3,40 @@
#
# Generated by: JumpCloud Solutions Architect Team
#
# Generated on: 12/17/2024
# Generated on: 12/16/2024
#

@{

# Script module or binary module file associated with this manifest.
RootModule = 'JumpCloud.psm1'
# Script module or binary module file associated with this manifest.
RootModule = 'JumpCloud.psm1'

# Version number of this module.
ModuleVersion = '2.16.0'
# Version number of this module.
ModuleVersion = '2.16.0'

# Supported PSEditions
# CompatiblePSEditions = @()
# Supported PSEditions
# CompatiblePSEditions = @()

# ID used to uniquely identify this module
GUID = '31c023d1-a901-48c4-90a3-082f91b31646'
# ID used to uniquely identify this module
GUID = '31c023d1-a901-48c4-90a3-082f91b31646'

# Author of this module
Author = 'JumpCloud Solutions Architect Team'
# Author of this module
Author = 'JumpCloud Solutions Architect Team'

# Company or vendor of this module
CompanyName = 'JumpCloud'
# Company or vendor of this module
CompanyName = 'JumpCloud'

# Copyright statement for this module
Copyright = '(c) JumpCloud. All rights reserved.'
# Copyright statement for this module
Copyright = '(c) JumpCloud. All rights reserved.'

# Description of the functionality provided by this module
Description = 'PowerShell functions to manage a JumpCloud Directory-as-a-Service'
# Description of the functionality provided by this module
Description = 'PowerShell functions to manage a JumpCloud Directory-as-a-Service'

# Minimum version of the PowerShell engine required by this module
PowerShellVersion = '4.0'
# Minimum version of the PowerShell engine required by this module
PowerShellVersion = '4.0'

# Name of the PowerShell host required by this module
# PowerShellHostName = ''
# Name of the PowerShell host required by this module
# PowerShellHostName = ''

# Minimum version of the PowerShell host required by this module
# PowerShellHostVersion = ''
Expand All @@ -50,10 +50,11 @@
# Processor architecture (None, X86, Amd64) required by this module
# ProcessorArchitecture = ''

# Modules that must be imported into the global environment prior to importing this module
RequiredModules = @('JumpCloud.SDK.DirectoryInsights',
'JumpCloud.SDK.V1',
'JumpCloud.SDK.V2')

# Modules that must be imported into the global environment prior to importing this module
RequiredModules = @('JumpCloud.SDK.DirectoryInsights',
'JumpCloud.SDK.V1',
'JumpCloud.SDK.V2')

# Assemblies that must be loaded prior to importing this module
# RequiredAssemblies = @()
Expand All @@ -70,42 +71,43 @@
# Modules to import as nested modules of the module specified in RootModule/ModuleToProcess
# NestedModules = @()

# Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export.
FunctionsToExport = 'Add-JCAssociation', 'Add-JCCommandTarget', 'Add-JCGsuiteMember',
'Add-JCOffice365Member', 'Add-JCRadiusReplyAttribute',
'Add-JCSystemGroupMember', 'Add-JCSystemUser',
'Add-JCUserGroupMember', 'Backup-JCOrganization', 'Connect-JCOnline',
'Copy-JCAssociation', 'Get-JCAdmin', 'Get-JCAssociation',
'Get-JCBackup', 'Get-JCCloudDirectory', 'Get-JCCommand',
'Get-JCCommandResult', 'Get-JCCommandTarget',
'Get-JCConfiguredTemplatePolicy', 'Get-JCEvent', 'Get-JCEventCount',
'Get-JCGroup', 'Get-JCOrganization', 'Get-JCPolicy',
'Get-JCPolicyGroup', 'Get-JCPolicyGroupMember',
'Get-JCPolicyGroupTemplate', 'Get-JCPolicyGroupTemplateMember',
'Get-JCPolicyResult', 'Get-JCPolicyTargetGroup',
'Get-JCPolicyTargetSystem', 'Get-JCRadiusReplyAttribute',
'Get-JCRadiusServer', 'Get-JCScheduledUserstate', 'Get-JCSystem',
'Get-JCSystemApp', 'Get-JCSystemGroupMember', 'Get-JCSystemInsights',
'Get-JCSystemKB', 'Get-JCSystemUser', 'Get-JCUser',
'Get-JCUserGroupMember', 'Import-JCCommand', 'Import-JCMSPFromCSV',
'Import-JCUsersFromCSV', 'Invoke-JCCommand', 'Invoke-JCDeployment',
'New-JCCommand', 'New-JCDeploymentTemplate', 'New-JCImportTemplate',
'New-JCMSPImportTemplate', 'New-JCPolicy', 'New-JCPolicyGroup',
'New-JCRadiusServer', 'New-JCSystemGroup', 'New-JCUser',
'New-JCUserGroup', 'Remove-JCAssociation', 'Remove-JCCommand',
'Remove-JCCommandResult', 'Remove-JCCommandTarget',
'Remove-JCGsuiteMember', 'Remove-JCOffice365Member',
'Remove-JCPolicy', 'Remove-JCPolicyGroup',
'Remove-JCPolicyGroupTemplate', 'Remove-JCRadiusReplyAttribute',
'Remove-JCRadiusServer', 'Remove-JCSystem', 'Remove-JCSystemGroup',
'Remove-JCSystemGroupMember', 'Remove-JCSystemUser', 'Remove-JCUser',
'Remove-JCUserGroup', 'Remove-JCUserGroupMember',
'Send-JCPasswordReset', 'Set-JCCloudDirectory', 'Set-JCCommand',
'Set-JCOrganization', 'Set-JCPolicy', 'Set-JCPolicyGroup',
'Set-JCRadiusReplyAttribute', 'Set-JCRadiusServer',
'Set-JCSettingsFile', 'Set-JCSystem', 'Set-JCSystemUser', 'Set-JCUser',
'Set-JCUserGroupLDAP', 'Update-JCModule', 'Update-JCMSPFromCSV',
'Update-JCUsersFromCSV'
# Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export.
FunctionsToExport = 'Add-JCAssociation', 'Add-JCCommandTarget', 'Add-JCGsuiteMember',
'Add-JCOffice365Member', 'Add-JCRadiusReplyAttribute',
'Add-JCSystemGroupMember', 'Add-JCSystemUser',
'Add-JCUserGroupMember', 'Backup-JCOrganization', 'Connect-JCOnline',
'Copy-JCAssociation', 'Get-JCAdmin', 'Get-JCAssociation',
'Get-JCBackup', 'Get-JCCloudDirectory', 'Get-JCCommand',
'Get-JCCommandResult', 'Get-JCCommandTarget',
'Get-JCConfiguredTemplatePolicy', 'Get-JCEvent', 'Get-JCEventCount',
'Get-JCGroup', 'Get-JCOrganization', 'Get-JCPolicy',
'Get-JCPolicyGroup', 'Get-JCPolicyGroupMember',
'Get-JCPolicyGroupTemplate', 'Get-JCPolicyGroupTemplateMember',
'Get-JCPolicyResult', 'Get-JCPolicyTargetGroup',
'Get-JCPolicyTargetSystem', 'Get-JCRadiusReplyAttribute',
'Get-JCRadiusServer', 'Get-JCScheduledUserstate', 'Get-JCSystem',
'Get-JCSystemApp', 'Get-JCSystemGroupMember', 'Get-JCSystemInsights',
'Get-JCSystemKB', 'Get-JCSystemUser', 'Get-JCUser',
'Get-JCUserGroupMember', 'Import-JCCommand', 'Import-JCMSPFromCSV',
'Import-JCUsersFromCSV', 'Invoke-JCCommand', 'Invoke-JCDeployment',
'New-JCCommand', 'New-JCDeploymentTemplate',
'New-JCDeviceUpdateTemplate', 'New-JCImportTemplate',
'New-JCMSPImportTemplate', 'New-JCPolicy', 'New-JCPolicyGroup',
'New-JCRadiusServer', 'New-JCSystemGroup', 'New-JCUser',
'New-JCUserGroup', 'Remove-JCAssociation', 'Remove-JCCommand',
'Remove-JCCommandResult', 'Remove-JCCommandTarget',
'Remove-JCGsuiteMember', 'Remove-JCOffice365Member',
'Remove-JCPolicy', 'Remove-JCPolicyGroup',
'Remove-JCPolicyGroupTemplate', 'Remove-JCRadiusReplyAttribute',
'Remove-JCRadiusServer', 'Remove-JCSystem', 'Remove-JCSystemGroup',
'Remove-JCSystemGroupMember', 'Remove-JCSystemUser', 'Remove-JCUser',
'Remove-JCUserGroup', 'Remove-JCUserGroupMember',
'Send-JCPasswordReset', 'Set-JCCloudDirectory', 'Set-JCCommand',
'Set-JCOrganization', 'Set-JCPolicy', 'Set-JCPolicyGroup',
'Set-JCRadiusReplyAttribute', 'Set-JCRadiusServer',
'Set-JCSettingsFile', 'Set-JCSystem', 'Set-JCSystemUser', 'Set-JCUser',
'Set-JCUserGroupLDAP', 'Update-JCDeviceFromCSV', 'Update-JCModule',
'Update-JCMSPFromCSV', 'Update-JCUsersFromCSV'

# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export.
CmdletsToExport = @()
Expand Down
12 changes: 6 additions & 6 deletions PowerShell/JumpCloud Module/Public/Systems/Get-JCSystemApp.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function Get-JCSystemApp () {
}
# Get the OS Type
if ($SystemID) {
$OSType = Get-JcSdkSystem -ID $SystemID -Fields osFamily | Select-Object -ExpandProperty OSFamily
$OSType = Get-JcSdkSystem -Id $SystemID -Fields osFamily | Select-Object -ExpandProperty OSFamily
} else {
$OSType = $SystemOS
if ($OSType -eq 'macOS') {
Expand Down Expand Up @@ -101,8 +101,8 @@ function Get-JCSystemApp () {
if ($name) {
# Check for .app at the end of the software name
$macOsSoftwareName = $name
$ending = $macOsSoftwareName.Substring($macOsSoftwareName.Length - 4)
If ($ending -match '.app') {
if ($macOsSoftwareName -match '.app') {
$ending = $macOsSoftwareName.Substring($macOsSoftwareName.Length - 4)
$macOsSoftwareName = $macOsSoftwareName.Replace($ending, $ending.toLower())
Write-Debug "$macOsSoftwareName"
} else {
Expand Down Expand Up @@ -217,8 +217,8 @@ function Get-JCSystemApp () {

} elseif ($os -eq 'MacOs') {
$macOsSoftwareName = $name
$ending = $macOsSoftwareName.Substring($macOsSoftwareName.Length - 4)
If ($ending -match '.app') {
if ($macOsSoftwareName -match '.app') {
$ending = $macOsSoftwareName.Substring($macOsSoftwareName.Length - 4)
$macOsSoftwareName = $macOsSoftwareName.Replace($ending, $ending.toLower())
Write-Debug "$macOsSoftwareName"
} else {
Expand Down Expand Up @@ -270,7 +270,7 @@ function Get-JCSystemApp () {
if ($version) {
Throw 'You cannot specify software version when using -search for a software name'
} elseif ($SystemId) {
$OSType = Get-JcSdkSystem -ID $SystemID | Select-Object -ExpandProperty OSFamily
$OSType = Get-JcSdkSystem -Id $SystemID | Select-Object -ExpandProperty OSFamily
Switch ($OSType) {
"Windows" {
$result = Get-JcSdkSystemInsightProgram -Filter @("system_id:eq:$SystemID")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,13 @@ Function Import-JCUsersFromCSV () {
$FormatGroupOutput = $Null
$CustomGroupArrayList = $Null

$CustomAttributes = $UserAdd | Get-Member | Where-Object Name -Like "*Attribute*" | Where-Object { $_.Definition -NotLike "*=" -and $_.Definition -NotLike "*null" } | Select-Object
# Get all the custom attributes that are not null
$CustomAttributes = $UserAdd | Get-Member | Where-Object Name -Like "*Attribute*" | Where-Object { $_.Definition -NotLike "*=" -and $_.Definition -NotLike "*null" }

# Sort the attributes by number and name
$CustomAttributes = $CustomAttributes | Sort-Object {
[int]([regex]::Match($_.Name, '\d+').Value) },
{ $_.Name }

Write-Verbose $CustomAttributes.name.count

Expand Down
Loading

0 comments on commit d86b6e2

Please sign in to comment.