Skip to content

Instantly share code, notes, and snippets.

@lwarnt
lwarnt / repall.ps1
Last active August 28, 2024 09:28
Replicate AD
function repall {
$cred = $(Get-Credential "domain\username")
(Get-ADDomainController -Filter *).Name | % {
$dc = $_
Start-Job {param($dc);Write-Host "== REP-$dc";repadmin /syncall $dc (Get-ADDomain).DistinguishedName /e /A; Start-Sleep 5} -ArgumentList $dc -Name "rep-$dc" -Credential $cred
}
While (Get-Job -State "Running" | ? {$_.Name -like "rep*"}) {
Start-Sleep 20
cls
@lwarnt
lwarnt / retry.py
Created August 5, 2022 10:01
Python decorator for retrying a function
#!/usr/bin/env python3
"""
Retry decorator
Example:
import requests
logging.basicConfig(
format="%(asctime)s | %(name)s | %(message)s",