Skip to content

Instantly share code, notes, and snippets.

@jworkmanjc
jworkmanjc / rename_header.ps1
Last active April 13, 2025 15:16
renames some CSV headers in a directory recursively
# Define the directory to search for CSV files
$directory = "/Path/To/Your/CSVs"
# Define the old column name and the new column name
$oldColumnName = "middle_name"
$newColumnName = "fiddle_name"
# Get all CSV files in the directory
$csvFiles = Get-ChildItem -Path $directory -Filter *.csv -Recurse
@jworkmanjc
jworkmanjc / inactiveDevicesSystemGroups.ps1
Created December 29, 2021 16:12
Remove inactive systems from system groups
# Get Devices from Group
$groupID = '61842933b54406680ae461aa'
$groupMembers = Get-JcSdkSystemGroupMember -GroupId $groupID
# Inactivity Threshold in days
$inactivityPeriod = 30
$currentTime = [Xml.XmlConvert]::ToString((get-date), [Xml.XmlDateTimeSerializationMode]::Utc)
# If system is inactive greater than the inactivity period, remove from group
foreach ($system in $groupMembers) {
@jworkmanjc
jworkmanjc / groupByOS.ps1
Created August 2, 2021 16:27
Group systems by OS
################################################################################
# This script requires the JumpCloud PowerShell Module to run. Specifically, the
# JumpCloud PowerShell SDK Modules are required to run the system queries. To
# install the PowerShell Modules, enter the following line in a PWSH terminal:
# Install-Module JumpCloud
#
# This script will search for systems and add them to system groups if they are
# not currently members of that group. It is intended to group systems by OS.
#
# This script can be run multiple times. As systems are added to JumpCloud, they
@jworkmanjc
jworkmanjc / SuspendAndQueryFunctions.ps1
Last active April 15, 2022 21:53
Suspend users who've not authenticated in the last 'x' days
function Get-JcLoginEvent
{
[CmdletBinding()]
param (
[Parameter(HelpMessage = "Set to true to print the number of users who would have been suspend, this will not suspend users")]
[switch]
$ReadOnly = $false,
[Parameter(Mandatory = $true, HelpMessage = "Path to the CSV file. If no such CSV file exists, it will be created. If the CSV file does exist, it will be updated.")]
[string]
$CsvPath,
@jworkmanjc
jworkmanjc / Group Systems by Software Install.ps1
Created June 17, 2021 02:55
Script to group systems based on whether or not they have a particular software title installed.
################################################################################
# This script requires the JumpCloud PowerShell Module to run. Specifically, the
# JumpCloud PowerShell SDK Modules are required to run the system queries. To
# install the PowerShell Modules, enter the following line in a PWSH terminal:
# Install-Module JumpCloud
#
# To run this script, update the 'SoftwareTitle' to search for a software title
# match in the system insights tables. Optionally edit the group name variables
# if you would like to change the group names.
#
@jworkmanjc
jworkmanjc / Invoke-ADMU-Migration-with-binds.ps1
Last active March 9, 2021 20:21
Invoke ADMU Migration w/ Admin Bind & System Group Bind
# JumpCloud API Key
$JcApiKey = ''
#check csv for duplicate rows per system
$CSV = "C:\Windows\Temp\admu_discovery.csv"
$Rows = Import-CSV -Path $CSV
$counts = $Rows | Group-Object ComputerName
foreach ($i in $counts)
{
if ($i.count -gt 1)
@jworkmanjc
jworkmanjc / invokeMobile2local.sh
Last active February 16, 2021 23:09
Invoke Mobile to Local for current user
#!/bin/bash
################################################################################
# This script will the latest version of Mobile to Local and prompt the current
# user to enter their password. This script can be run from the JumpCloud
# command console but will wait for user input before before marking the script
# complete in the results window.
# Refer to https://github.com/BIG-RAT/mobile_to_local for tool usage
################################################################################
@jworkmanjc
jworkmanjc / AccountRenameRealName.sh
Created January 25, 2021 17:40
Rename A User's RealName Attribute if it exists from firstname to lastname
#!/bin/bash
################################################################################
# This script will pull the provisionerID from the JumpCloud console and rename
# the specified user account to the matching username in JumpCloud. This script
# will not rename or remap the user's home directory.
################################################################################
# Variables
@jworkmanjc
jworkmanjc / AddToGroup.ps1
Last active January 20, 2021 22:33
This powershell script requires the JumpCloud Powershell Module, for new systems added in the last day those systems will be added to the beforeRename group.
################################################################################
# For every system with a provisionerID, if acknowledged is false, add to the
# systemGroup "BeforeRename".
################################################################################
# Powershell script to run locally as new systems are added
# Variables
# BeforeRename System GroupID
$beforeRenameGroupID = 'replaceWithBeforeGroupID'
# After account rename group
@jworkmanjc
jworkmanjc / windowsRenameToProvisionerUser.ps1
Created January 20, 2021 19:42
This script will search a windows system for the UserToRename user, if it exists, it will rename that account to the username who installed JumpCloud from the user portal
################################################################################
# This script will pull the provisionerID from the JumpCloud console and rename
# the specified user account to the matching username in JumpCloud. This script
# will not rename or remap the user's home directory.
################################################################################
# Variables
# User to match and rename (case insensitive)
$UserToRename='oyo'