Reworking the Script
Throw out everything you know about scripts while disregarding any fears or anxieties you have around the command-line. Scripting can be easy, fun, and make your life 10x easier the more you use it. Before writing a script you should think of a key objective or goal that you would like to accomplish. Going into writing a script, you should have a clear understanding of what you would like to be able to achieve, then you can go into writing the draft.
PowerShell executable script files are saved and written with the ps1 file extension. You can then execute these scripts via PowerShell by running the following command in the prompt:
Luckily if you’re just starting with JumpCloud and PowerShell, we have a full GitHub Wiki with all of the commands that you can use to manage your JumpCloud organization. If you leverage these pre-written commands in tandem with your tenant, you could easily compile a script to perform a specific action.
Imagine you are looking to list all Users without MFA enabled on their accounts, enable MFA on your Users, as well as enabling MFA on a System Group’s systems that do not have it enabled already. This can be done through the UI with several clicks through a few different menus, or could be easily compiled within a script where you can perform both tasks with a singular call.
For example, contents of a script to achieve this could be:
#Get all Users with MFA disabled on their JumpCloud User Account and enable it#
Get-JCUser -enable_user_portal_multifactor $false | Set-JCUser -enable_user_portal_multifactor $True
#Get all Systems within the All Systems Group with MFA disabled and enable it#
Get-JCSystemGroupMember -GroupName “All Systems" | Set-JCSystem -allowMultiFactorAuthentication $true
Using JumpCloud’s GitHub Wiki, there are a boatload of PowerShell Commands which are pre-written for many of your daily tasks that you could do within JumpCloud. You could either copy and paste these commands straight into the JumpCloud PowerShell Module window, or you could compile several of these commands into executable ps1 script files.
As JumpCloud builds out more and more of the product, the JumpCloud PowerShell Module is updated so you have the power and flexibility to manage your JumpCloud tenant with a few commands or a few simple scripts.
Automate Your Day
When it comes down to brass tacks, all admins generally want the same thing. A day where they can hit a few buttons or run a few scripts and be off about their day focusing on higher priority projects or tasks. With automation, leveraging JumpCloud’s PowerShell Module, you can do that with relative ease.
Even if you’re new to the shell world and are not acquainted with scripting, we’ve provided a well written library and wiki within our GitHub page, blogs, and other resources. We believe that a day in the life of an admin shouldn’t be burdensome and littered with dozens of minor tasks. You should be able to execute a task simply within either a few clicks in the Admin Portal or within a simple script using the JumpCloud PowerShell Module.
If you’re unsure about running certain commands or want to test your scripting before running it in production, we got you! You can simply sign up for a free JumpCloud account with up to 10 users and 10 devices for life today if you haven’t already created one. Use this secondary free account for your testing while leaving your production JumpCloud tenant alone. This flexibility gives you the power to test your scripts in a test environment first before running them in your production environment to ensure your syntax and commands are what you want them to be.
If you’re interested in understanding more about PowerShell, JumpCloud, or our API, check out the resources below for more details!