Skip to content

Instantly share code, notes, and snippets.

<#----------------------------------------------------------------------------------------------------------------------------
August 2017 - Robin Beismann - Michael Wessel Informationstechnologie GmbH
This script creates dummy users for MAC based Microsoft NPS Radius authentication by using MAC Addresses out of a specific
AD User Attribut containing MAC Addresses seperated by semicolas
CAUTION: THIS WILL DELETE ALL USERS OUT OF A SPECIFIC ORGANIZATIONAL UNIT IF THEY MATCH THE SCHEMA!
----------------------------------------------------------------------------------------------------------------------------#>
#Define base OU for the dummy users
<#----------------------------------------------------------------------------------------------------------------------------
August 2017 - Robin Beismann - Michael Wessel Informationstechnologie GmbH
This script copys the CRLs from the different sites onto the DMZ Webserver(s)
config.xml may look like:
<Config>
<source share="<to be filled>" username="<to be filled>" password="<to be filled>"/>
<destination share="<to be filled>" username="<to be filled>" password="<to be filled>"/>
@RobinBeismann
RobinBeismann / Fill-OldOUAttribute.ps1
Last active October 15, 2017 22:46
Code Vorschlag
[regex]$regex = "(?:,)(?'name'((CN|OU=).*))"
Get-ADUser -Filter * -SearchBase "OU=Benutzer,DC=ad2016,DC=faq-o-matic,DC=net" | ForEach-Object {
$ou = $regex.Match($_.DistinguishedName).Groups['name']
Write-Host($_.Name + ": $ou")
$_ | Set-ADUser -Add @{info=$ou}
}
#region Variable Definition
$dryRun = $true
$searchBase = (Get-ADDomain).DistinguishedName
#endregion
#region Code below
#Gather the DomainSID
$domainSID = (Get-ADDomain).DomainSid.Value
#Fix on one DC so we don't run into replication problems after adding a user to a group
@RobinBeismann
RobinBeismann / join.sh
Created January 2, 2018 01:33
PBIS Open Domain Joining
wget https://github.com/BeyondTrust/pbis-open/releases/download/8.5.7/pbis-open-8.5.7.385.linux.x86_64.deb.sh;
chmod +x pbis-open-*.sh;
./pbis-open-*.sh;
/opt/pbis/bin/domainjoin-cli join contoso.com binduser "bindpw";
pam-auth-update --force;
/opt/pbis/bin/config UserDomainPrefix CONTOSO;
Moved to https://github.com/RobinBeismann/PowerShell-Scripts/blob/master/PKI/Enroll-DMZ-OCSP-Responder-Certificate
$installFolder = "$env:ProgramFiles\BomgarJumpClient"
if(
(Test-Path -Path $installFolder) -and
(Test-Path -Path "$installFolder\bomgar-scc.exe") -and
(Test-Path -Path "$installFolder\server.lic")
){
Get-ChildItem -Path $installFolder | Where-Object { $_.LastWriteTime -gt (Get-Date).AddDays(-7) } | ForEach-Object {
"Installed"
}
}
@RobinBeismann
RobinBeismann / Set-DelegateList.ps1
Created October 9, 2020 14:28
Set-DelegateList.ps1
#Load Modules
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.SnapIn;
Import-Module ActiveDirectory
try{
Write-Host("Retrieving AD Users")
$ADUsers = Get-ADUser -Filter * -Properties objectSID, msExchMasterAccountSid, sidHistory, msExchDelegateListLink -ErrorAction Stop
Write-Host("Retrieving Mailbox Permissions")
$MailboxPerm = Get-MailboxPermission -ResultSize Unlimited -Identity * -ErrorAction Stop
$installParams = @(
"--jc-name `"$($env:computername)`"",
"--install-dir `"$AgentInstallPath`"",
"--jc-jump-group `"jumpgroup:$BomgarJumpGroup`"",
"--jc-session-policy-present `"$BomgarSessionPolicy_Customer_present`"",
"--jc-session-policy-not-present `"$BomgarSessionPolicy_Customer_not_present`"",
"--silent"
)
Write-Log -Message "Installing Bomgar to $AgentInstallPath"
Write-Log -Message "Executing: $binary $($installParams -join " ")"
if($membersToAdd.Count -gt 0){
Write-Host("Writing membersToAdd")
$chunkArr = $membersToAdd
$chunks = [System.Collections.ArrayList]::new()
for ($i = 0; $i -lt $chunkArr.Count; $i += 20) {
if(($chunkArr.Count - $i) -gt 19) {
$null = $chunks.add($chunkArr[$i..($i + 19)])
}else{
$null = $chunks.add($chunkArr[$i..($chunkArr.Count - 1)])