Skip to content

Instantly share code, notes, and snippets.

View zjorz's full-sized avatar

Jorge de Almeida Pinto | IAMTEC zjorz

View GitHub Profile
@zjorz
zjorz / Triggering-Scheduled-Task-On-DCs-On-Demand-To-Initiate-DSRM-Password-Sync.ps1
Last active October 21, 2025 19:03
Triggering Scheduled Task On DCs On Demand To Initiate DSRM Password Sync
# SOURCE: https://gist.github.com/zjorz/93f5407552d30c70378384962c079fb4/
Invoke-Command -ScriptBlock {
Clear-Host
$scriptMode = "ADSIorSDSP" # "ADSIorSDSP" Or "ADPoSH"
Write-Host ""
Write-Host "###############################################################################" -Foregroundcolor Yellow
@zjorz
zjorz / Displaying-DSRM-Sync-State-Across-All-DCs-In-AD-Domain.ps1
Last active October 21, 2025 19:03
Displaying The DSRM Sync State Across All DCs In The AD Domain
# SOURCE: https://gist.github.com/zjorz/aa9a8d8edc4da25043a0a757aee22006/
Invoke-Command -ScriptBlock {
Clear-Host
$scriptMode = "ADSIorSDSP" # "ADSIorSDSP" Or "ADPoSH"
Write-Host ""
Write-Host "###############################################################################" -Foregroundcolor Yellow
@zjorz
zjorz / Resetting-The-DSRM-Placeholder-Account-Password-For-RODCs.ps1
Last active October 21, 2025 19:03
Code to be used in the process to reset the DSRM Placeholder Account password while removing (allowing sync) or adding (denying sync) restrictions
# SOURCE: https://gist.github.com/zjorz/fc6a4f33539fcfaaa11a6c11c564f37d/
Invoke-Command -ScriptBlock {
Clear-Host
$scriptMode = "ADSIorSDSP" # "ADSIorSDSP" Or "ADPoSH"
Write-Host ""
Write-Host "###############################################################################" -Foregroundcolor Yellow
@zjorz
zjorz / Resetting-The-DSRM-Placeholder-Account-Password-For-RWDCs.ps1
Last active October 21, 2025 19:03
Code to be used in the process to reset the DSRM Placeholder Account password while removing (allowing sync) or adding (denying sync) restrictions
# SOURCE: https://gist.github.com/zjorz/2f22beabedb1f0f68e172a1c6377842f/
Invoke-Command -ScriptBlock {
Clear-Host
$scriptMode = "ADSIorSDSP" # "ADSIorSDSP" Or "ADPoSH"
Write-Host ""
Write-Host "###############################################################################" -Foregroundcolor Yellow
@zjorz
zjorz / Creating-And-Configuring-The-PSO-For-DSRM-Placeholder-Accounts.ps1
Last active October 21, 2025 19:02
Creating And Configuring The PSO For DSRM Placeholder Accounts
# SOURCE: https://gist.github.com/zjorz/83523ecb5cdffa974e959f280ab3469b/
Invoke-Command -ScriptBlock {
Clear-Host
$scriptMode = "ADSIorSDSP" # "ADSIorSDSP" Or "ADPoSH"
Write-Host ""
Write-Host "###############################################################################" -Foregroundcolor Yellow
@zjorz
zjorz / SYNC_DSRM_ACCOUNT_PASSWORD.PS1
Last active October 21, 2025 19:04
Code to sync password from DSRM Placeholder Account in AD to the local DSRM Admin Account on DCs
# SOURCE: https://gist.github.com/zjorz/6a565db8d49e43b86fc965fc08331e24/
Invoke-Command -ScriptBlock {
Clear-Host
$scriptMode = "ADSIorSDSP" # "ADSIorSDSP" Or "ADPoSH"
Write-Host ""
Write-Host "###############################################################################" -Foregroundcolor Yellow
@zjorz
zjorz / Permission-Private-Key-Associated-Certificate-For-Specific-Account.ps1
Created October 4, 2025 20:23
Permission The Private Key Associated With A Certificate With Allow:Read For A Specific Account
$action = "<ACTION TO EXECUTE>" # "SET" OR "CHECK" <= CONFIGURE THIS!!!!!
$account = "<DOMAIN>\<SAMACCOUNTNAME>" # <= CONFIGURE THIS!!!!!
$certificateThumbprint = "<CERTIFICATE THUMBPRINT>" # <= CONFIGURE THIS!!!!!
$certStoreLocation = "Cert:\LocalMachine\My"
Invoke-Command -ArgumentList $action,$account,$certificateThumbprint,$certStoreLocation -ScriptBlock {
Param (
$action,
$account,
$certificateThumbprint,
# SOURCE: https://gist.github.com/zjorz/d3221678d2fa4f4579f4c35eefd39333/
Invoke-Command -ScriptBlock {
Clear-Host
$scriptMode = "ADSIorSDSP" # "ADSIorSDSP" Or "ADPoSH"
Write-Host ""
Write-Host "###############################################################################" -Foregroundcolor Yellow
# SOURCE: https://gist.github.com/zjorz/f7d8dd924daddc8b9023dc2be358049b/
Invoke-Command -ScriptBlock {
Clear-Host
$scriptMode = "ADSIorSDSP" # "ADSIorSDSP" Or "ADPoSH"
Write-Host ""
Write-Host "###############################################################################" -Foregroundcolor Yellow
@zjorz
zjorz / Bad-Successor-ENABLING-BLOCK-v2.ps1
Last active September 2, 2025 13:18
Bad Successor - ADDING/ENABLING BLOCK v2
# ===============================================================================
# Bad-Successor-ENABLING-BLOCK v2
# Setting systemOnly For 'CN=ms-DS-Managed-Account-Preceded-By-Link' To **TRUE**
# Setting systemOnly For 'CN=ms-DS-Superseded-Managed-Account-Link' To **TRUE**
# ===============================================================================
#
# SOURCE: https://gist.github.com/zjorz/809fc4b4da5c670ff2ecc324ac4f60ef
#
# WARNING: This Code Can ONLY Be Used When The W2K25 AD Schema Has Been Implemented! There IS NO Check To Validate This!
# WARNING: Membership of Schema Admins Is Required