This file contains hidden or 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
# Get all the groups in the OU we're targeting | |
$groups = Get-ADGroup –Filter * -SearchBase “OU=File Shares,OU=Groups,DC=Contoso,DC=com” | |
# Recurse through each group | |
Foreach ($group in $groups) { | |
# Make it universal | |
$group | Set-ADGroup –GroupScope 2 | |
# Make it global | |
$group | Set-ADGroup –GroupScope 1 | |
} |
This file contains hidden or 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-Type -AssemblyName System.speech | |
$ss = New-Object System.Speech.Synthesis.SpeechSynthesizer | |
$ss.Rate = -3 | |
$ss.Speak("Hello I am a computer") |
This file contains hidden or 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
# Get all users with MFA enabled | |
# Import MSOL Module | |
Import-Module MSOnline | |
# Connect to the service | |
Connect-MsolService | |
#Find all MFA enabled users | |
$MfaUsers = Get-MsolUser -All | Where-Object {$_.StrongAuthenticationRequirements -like "*"} |
This file contains hidden or 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
# Import MSOL Module | |
Import-Module MSOnline | |
# Connect to the service | |
Connect-MsolService | |
# What's the AAD Sku? We'll assign this to admins | |
$aadSku = (Get-MsolAccountSku | Where {$_.AccountSkuId -ilike "*:AAD_PREMIUM"})[0].AccountSkuId | |
# Define StrongAuthentication (MFA) requirements |
This file contains hidden or 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
$SearchBase = "DC=MargiesTravel,DC=com" | |
# Get all the users who have proxyAddresses under the margiestravel.com domain | |
foreach ($user in (Get-ADUser -SearchBase $SearchBase -LdapFilter '(proxyAddresses=*)')) { | |
# Grab the primary SMTP address | |
$address = Get-ADUser $user -Properties proxyAddresses | Select -Expand proxyAddresses | Where {$_ -clike "SMTP:*"} | |
# Remove the protocol specification from the start of the address | |
$newUPN = $address.SubString(5) | |
# Update the user with their new UPN | |
Set-ADUser $user -UserPrincipalName $newUPN |
This file contains hidden or 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
# Site to check | |
$site = "https://www.github.com" | |
# Seconds between checks | |
$interval = 2 | |
while ($true) { | |
$result = try { Invoke-WebRequest $site -ErrorAction silentlycontinue } catch { $null } | |
if ($result.statuscode -eq 200) { | |
Write-Host "$site is up" -BackgroundColor green -ForegroundColor white | |
} else { |
This file contains hidden or 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-ImmutableId ($a) { | |
[System.Convert]::ToBase64String(([guid](Get-ADUser $a -Properties ObjectGuid).ObjectGuid).ToByteArray()) | |
} | |
## | |
## WARNING: This script does not health check anything at all. | |
## If you run it without knowing what it does, you | |
## will probably break the internet, and not in the good way. | |
## |
This file contains hidden or 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
$logFile = "$pwd\dns.log" | |
$newLogFile = "$pwd\dns_cleaned.log" | |
$sr = New-Object System.IO.StreamReader($logFile) | |
$sw = New-Object System.IO.StreamWriter($newLogFile) | |
$line = $sr.ReadLine() | |
while ($line -ne $null) { | |
if ($line.trim() -ne "") { |
This file contains hidden or 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
$logFile = "dns2_cleaned.log" | |
$sr = New-Object System.IO.StreamReader($logFile) | |
$line = $sr.ReadLine() | |
$packets = @() | |
while ($line -ne $null) { |
OlderNewer