cancel
Showing results for 
Search instead for 
Did you mean: 

Rename Hostnames from JumpCloud Display Name Workflow

jworkman
JumpCloud Employee
JumpCloud Employee

I've seen this request pop up a few times and want to provide a general workflow for those who wish to rename system hostnames from the Display Name field in JumpCloud.

For those interested in more, I highly suggest the Advanced PowerShell Course on JumpCloud University. I've recorded how we can update systems display names based on device attributes. That series is a good introduction to advanced automations within the JumpCloud Module or PowerShell general.

In this example I'll just provide the steps to:

  1. Get a CSV of systems from the JumpCloud PowerShell Module
  2. Manually rename each devices "Display Name"
  3. Finally update each mac/ windows/ ubuntu device's Hostnames with corresponding scripts.

First let's get a CSV of all my systems. To do this let's run a simple script:

Connect-JCOnline "yourApiKey"
$systems = Get-JCSystem
$systems | ConvertTo-CSV | Out-File ./JumpCloudSystems.csv

This script will create a list of JumpCloud systems in your current working directory called "JumpCloudSystems.csv". Open this file with your editor of choice.

Next it's time to manually edit this file and update the column for "DisplayName" to be whatever you wish. Later we'll use our prebuilt scripts to update the device hostnames from the "DisplayName" of the desired system. In the screenshot below I've just written a short formula to concatenate the "SerialNumber" Column and "OsFamily" fields into the "DisplayName" Column.

Screen Shot 2022-11-30 at 3.14.02 PM.png

Save the CSV. Next we'll update all the DisplayNames on JumpCloud.

$csv = Import-CSV -Path ./JumpCloudSystems.csv
foreach ($line in $csv){
    Set-JCSystem -SystemId $line._id -DisplayName $line.displayName
}

This script will update each system's display name within JumpCloud.

Screen Shot 2022-11-30 at 3.18.32 PM.png

Now that the display names have been set if you need to update systems actual hostnames follow the instructions for each mac/ windows/ ubuntu script. (These can be imported by clicking the Commands Tab, then adding a new command from Template, search for "rename"). In my organization. I've grouped all my systems by operating system using this script (which if run again will add new systems to their respective OS group). I've assigned my mac/ windows/ ubuntu scripts to each of these device groups and set the scripts to run once.

By default commands TTL settings are three days, I kicked off my commands manually so they will stick around the commands queue for three days before expiring. I can check the commands results tab to keep track of which systems were renamed and their status.

Screen Shot 2022-11-30 at 3.27.13 PM.png

Depending on the OS, hostnames may not be set to the full length of the DisplayName stored in JumpCloud. Refer to your vendor and operating systems for specific limitations.

0 REPLIES 0
You Might Like

New to the site? Take a look at these additional resources:

Community created scripts:

Our new Radical Admin blog:

Keep up with Product News:

Read our community guidelines

Ready to join us? You can register here.