Skip to content

Instantly share code, notes, and snippets.

View PatrickTerlisten's full-sized avatar

Patrick Terlisten PatrickTerlisten

View GitHub Profile
@PatrickTerlisten
PatrickTerlisten / redistribute-vm.ps1
Created January 15, 2023 11:04
Save a VM <> host mapping and redistribute VMs according to the stored mapping
### Discover all VMs in a specific vSphere Cluster
$AllVMs = Get-Cluster PROD | Get-VM | ? { $_.Name -notlike 'vCLS*' }
### Create empty hash table
$hashtable = @{}
### Fill hash table with a mapping VM <> host
foreach ($i in $AllVMs) {
$hashtable.add($i.name, $i.vmhost)
}
@PatrickTerlisten
PatrickTerlisten / Get-NewADUser.ps1
Created February 6, 2022 11:10
E-Mail notification for new AD user
#Get events
$Event = Get-EventLog -LogName Security -InstanceId 4720 -Newest 1
#get some details
$User = $Event.ReplacementStrings[0]
$Creator = $Event.ReplacementStrings[4]
$Domain = $Event.ReplacementStrings[5]
# smtp server
@PatrickTerlisten
PatrickTerlisten / Get-NewMemberUniversalGroup.ps1
Created February 6, 2022 10:43
E-Mail notification for new member in universal group
#Get events
$Event = Get-EventLog -LogName Security -InstanceId 4756 -Newest 1
#get some details
$User = $Event.ReplacementStrings[0]
$Antragsteller = $Event.ReplacementStrings[6]
$Gruppe = $Event.ReplacementStrings[2]
# smtp server
@PatrickTerlisten
PatrickTerlisten / Get-NewMemberLocalGroup.ps1
Created February 6, 2022 10:43
E-Mail notification for new member in domain-local group
#Get events
$Event = Get-EventLog -LogName Security -InstanceId 4732 -Newest 1
#get some details
$User = $Event.ReplacementStrings[0]
$Antragsteller = $Event.ReplacementStrings[6]
$Gruppe = $Event.ReplacementStrings[2]
# smtp server
@PatrickTerlisten
PatrickTerlisten / Get-NewMemberGlobalGroup.ps1
Created February 6, 2022 10:42
E-Mail notification for new member in domain-global group
#Get events
$Event = Get-EventLog -LogName Security -InstanceId 4728 -Newest 1
#get some details
$User = $Event.ReplacementStrings[0]
$Antragsteller = $Event.ReplacementStrings[6]
$Gruppe = $Event.ReplacementStrings[2]
# smtp server
@PatrickTerlisten
PatrickTerlisten / Get-AccountLockout.ps1
Created February 6, 2022 10:41
E-Mail notification on account lockout
#Get events
$Event = Get-EventLog -LogName Security -InstanceId 4740 -Newest 1
#get some details
$User = $Event.ReplacementStrings[0]
$Computer = $Event.ReplacementStrings[1]
$Domain = $Event.ReplacementStrings[5]
# smtp server
# Liste aller Mailboxen
$Mailboxes = Get-Mailbox -OrganizationalUnit "OU=lamadrama,DC=domain,DC=local" | Sort-Object -Property Alias
# Liste der fehlgeschlagenen Mailboxen
$FailedMailboxes = @()
# Begrenzt die Anzahl der zu verarbeitenden Mailboxen
# $Mailboxes = $Mailboxes[0..4]
# Hier passiert die Magie...
@PatrickTerlisten
PatrickTerlisten / netscaler-config-script-exchange-2013-2016.txt
Last active December 4, 2019 12:56
Citrix NetScaler config for Exchange 2013/ 2016 with a single namespace
# Replace srv_exchange with the desired server name and ip address
# Add one server object for each of your Exchange servers
add server srv_exchange1 x.x.x.x
add server srv_exchange2 x.x.x.y
# Replace x.x.x.x with the desired IP address
add cs vserver cs_vsrv_exchange SSL x.x.x.x 443 -cltTimeout 180 -caseSensitive OFF
add lb vserver lb_vsrv_exchange_owa SSL 0.0.0.0 0 -persistenceType NONE -cltTimeout 180
add lb vserver lb_vsrv_exchange_ecp SSL 0.0.0.0 0 -persistenceType NONE -cltTimeout 180
add lb vserver lb_vsrv_exchange_ews SSL 0.0.0.0 0 -persistenceType NONE -cltTimeout 180
sudo apt-get update
sudo apt-get install apt-transport-https ca-certificates -y
sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
sudo apt-add-repository 'deb https://apt.dockerproject.org/repo ubuntu-xenial main'
sudo apt-get update
sudo apt-get purge lxc-docker
sudo apt-get install linux-image-extra-$(uname -r) -y
sudo apt-get install docker-engine cgroup-lite apparmor -y
sudo usermod -a -G docker $USER
sudo service docker start
@PatrickTerlisten
PatrickTerlisten / Fix-iovDisableIRSetting.ps1
Created April 5, 2017 14:54
This script checks if the iovDisableIR setting is set to FALSE. If not, it will set iovDisableIR to FALSE.
<#
.SYNOPSIS
This script checks if the iovDisableIR setting is set to FALSE. If not, it will set iovDisableIR to FALSE.
.DESCRIPTION
The script checks the current setting of the Intel IOMMU interrupt remapper (iovDisableIR) and changes the setting
if necessary.
The script needs a single parameter: