Skip to content

Instantly share code, notes, and snippets.

View jschlackman's full-sized avatar

James Schlackman jschlackman

View GitHub Profile
<#
.SYNOPSIS
Assigns an imported list of users to an Okta application using the Okta API.
.DESCRIPTION
Imports a list of users from a CSV file, matches it against existing Okta users, and sets application assignments for each user in a specified application.
Author: James Schlackman <[email protected]>
Last Modified: March 14 2025
<#
.SYNOPSIS
Run a PowerShell command in the 64-bit host.
.DESCRIPTION
When called from a 32-bit host executable, the specified command block will be run using the 64-bit Powershell host.
If called from a 64-bit host, the command is simply run in the current host.
.PARAMETER CommandBlock
Command block to execute.
@jschlackman
jschlackman / Remove-DeletedAdObject.ps1
Created January 16, 2025 02:02
List all objects in the Active Directory Recycle Bin and allow selection of an object to be permanently removed immediately
Get-AdObject -Filter 'IsDeleted -eq $True' -IncludeDeletedObjects -Properties * | Out-GridView -OutputMode Single | Remove-ADObject
@jschlackman
jschlackman / Enroll-EntraJoinedToIntune.ps1
Created January 16, 2025 01:58
Trigger Intune enrollment for Entra-joined devices that were not configured for automatic enrollment on initial join
# Check enrollment URLs at
# https://intune.microsoft.com/#view/Microsoft_AAD_IAM/MdmConfiguration.ReactView/appId/0000000a-0000-0000-c000-000000000000/appName/Microsoft.Intune
# Set MDM Enrollment URLs
$joinedTenantKey = (Get-ChildItem 'HKLM:\SYSTEM\CurrentControlSet\Control\CloudDomainJoin\TenantInfo')
$joinedTenantKey | New-ItemProperty -Name 'MdmTermsOfUseUrl' -Value 'https://portal.manage.microsoft.com/TermsofUse.aspx' -PropertyType String -Force
$joinedTenantKey | New-ItemProperty -Name 'MdmEnrollmentUrl' -Value 'https://enrollment.manage.microsoft.com/enrollmentserver/discovery.svc' -PropertyType String -Force
$joinedTenantKey | New-ItemProperty -Name 'MdmComplianceUrl' -Value 'https://portal.manage.microsoft.com/?portalAction=Compliance' -PropertyType String -Force
<#
.SYNOPSIS
Retrieves an audit of MX, SPF, and DMARC records from public DNS for a given list of domains.
.DESCRIPTION
Author: James Schlackman
Last Modified: March 20 2025
.PARAMETER DomainPath
Pathname to CSV file with list of domains to check.
<#
.SYNOPSIS
Starts automatic update for all installed Visual Studio instances.
.DESCRIPTION
Gets details of all current Visual Studio installs on this machine and attempts to run the updater for each installation found.
This script can be run using Task Scheduler or an RMM to periodicially check for and apply Visual Studio updates.
Author: James Schlackman <[email protected]>
Last Modified: March 6 2025
# Name: Get-AzureStorageEncryptionDetails.ps1
# Author: James Schlackman
# Last Modified: May 1 2024
#
# Lists all storage accounts with their encryption settings.
#Requires -Modules Az.Accounts, Az.Storage
Param(
[Parameter()] [String] $AzTenant,
<#
.SYNOPSIS
Searches for and updates Jira users in preparation for SSO by changing their login name to match their email address.
.DESCRIPTION
Uses the Jira Server API (via the JiraPS module) to bulk update the usernames of selected Jira users so that their login name matches their email address, allowing them to be correctly logged in via SSO mechanisms such as SAML.
Author: James Schlackman
Last Modified: January 29 2025
@jschlackman
jschlackman / ConnectWise Access Management webhook payload for Teams.json
Created January 18, 2024 17:52
JSON payload for webhooks sent from ScreenConnect to Teams for the ConnectWise Access Management feature. This is an alternative to the official integration, allowing more flexibility in terms of which requests are forwarded and using more concise and modern adaptive card formatting.
{{
"type": "message",
"attachments": [
{{
"contentType": "application/vnd.microsoft.card.adaptive",
"contentUrl": null,
"content": {{
"type": "AdaptiveCard",
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"version": "1.4",
# Name: Remove-ADUserAdmins.ps1
# Author: James Schlackman
# Last Modified: Dec 19 2023
# Clear individual non-local (e.g. AD) users from the local administrators group
# Notes:
# - Uses CIM to retrieve local group membership as Get-LocalGroupMember does not work without DC connectivity
# - Must be run in 64-bit PowerShell Host. The LocalAccounts module is not available in 32-bit PowerShell on a 64-bit system.