This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ACHTUNG! Das funktioniert nur, wenn das Company Attribut bei euren E-Mail Empfängern richtig gesetzt ist. | |
# Falls das Company Attribut leer ist, oder ein anderer Wert drin ist, müsst ihr einen anderen Filter verwenden. | |
# Oder das Attribut bei den Usern entsprechend setzen. | |
$CompanyName = "Demotenant" | |
New-DynamicDistributionGroup -Name "Alle-$($CompanyName)-Empfänger" -RecipientFilter "company -like '$($CompanyName)*'" | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Windows Registry Editor Version 5.00 | |
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PolicyManager\default\Start\HideRestart] | |
"value"=dword:00000001 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Script: Beispiel1.ps1 | |
Write-Host '$a='$a | |
$a = "moin" | |
Write-Host '$a='$a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
switch(Get-Date) { | |
# $PSItem ist übrigens das gleiche wie $_ | |
{$PSItem.Year -gt 2022} { | |
"Es ist nach 2022" | |
break | |
} | |
default { | |
"Es ist vor 2023" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Get-MachineSID { | |
# Going for the local SID by finding a local account and removing its Relative ID (RID) | |
$LocalAccountSID = Get-WmiObject -Query "SELECT SID FROM Win32_UserAccount WHERE LocalAccount = 'True'" |Select-Object -First 1 -ExpandProperty SID | |
$MachineSID = $LocalAccountSID -replace '-[^-]+$' | |
return $MachineSID | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
Hashtable Access Performance Test | |
Settings: | |
$maxentries = Number of entries to put into the hashtable | |
$iterations = Number of access test per method | |
#> | |
$maxentries = 100000 | |
$iterations = 5000 | |
$meineHashtable = @{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Convert-SPOTimezoneToString( | |
# ID of a SPO Timezone | |
[int]$ID | |
) { | |
<# | |
.SYNOPSIS | |
Convert a Sharepoint Online Time zone ID to a human readable string. | |
.NOTES | |
By Andreas Dieckmann - https://diecknet.de |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
######################################################################################## | |
# Add DNS Host A entry with PowerShell | |
# Forward / Host A | |
Add-DnsServerResourceRecordA -Name "test123" -ZoneName "myzone.local" -IPv4Address "10.0.0.1" -ComputerName mydnsserver | |
# Add PTR: | |
Add-DnsServerResourceRecordPtr -ZoneName 00.10.in-addr.arpa -Name 1.0 -PtrDomainName myhost.myzone.local -ComputerName mydnsserver | |
######################################################################################## |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
I initially used this code: | |
history | Select-Object -Last 1 -ExpandProperty CommandLine | clip | |
But recently found this shorter version at https://powershellmagazine.com/post/2012-11-06-pstip-send-the-last-command-executed-to-clipboard/ | |
#> | |
(Get-History)[-1].commandline | clip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# by diecknet | |
# This script is mostly based on code by reddit users /u/bernys and /u/Lanathell | |
# I added checks to see if DNS service is running again. | |
# Also see: | |
# - https://support.microsoft.com/en-us/help/4569509/windows-dns-server-remote-code-execution-vulnerability | |
# - https://www.reddit.com/r/sysadmin/comments/hr5dfe/keep_your_eyes_out_for_a_critical/ | |
#> | |
Import-Module ActiveDirectory | |
$AllDomainControllers = (Get-ADForest).Domains | %{ Get-ADDomainController -Filter * -Server $_ } |
NewerOlder