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 Compare-FileToHash { | |
<# | |
.SYNOPSIS | |
Compare-FileToHash - Compares a file to a given hash and returns a boolean of whether they match or not | |
.DESCRIPTION | |
This function will compare a file to a given hash (in string format) and | |
returns the boolean $true or $false depending on whether the hashes match. | |
Supported algorithms are all those supported by Get-FileHash. | |
.EXAMPLE |
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
# Alert whenever the free space on disk falls below the following factor | |
# .20 = 20 % | |
# .10 = 10 % | |
$alarmThreshold = ".20" | |
$pushoverUrl = "https://api.pushover.net/1/messages.json" | |
$pushoverToken = "" | |
$pushoverUserKey = "" |
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
<# | |
.SYNOPSIS | |
Get-MailboxItemsByClass.ps1 - Returns a count of mailbox items of the specified class. | |
.DESCRIPTION | |
This function will return a count of the number of items in a mailbox matching the specified class. | |
Uses EWS Managed API to perform the check | |
.EXAMPLE | |
.\Get-MailboxItemsByClass.ps1 -MailboxToSearch [email protected] -ItemStubClass IPM.Note -StoredCredentialUsername [email protected] | |
.LINK | |
https://flamingkeys.com/ |
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-Module ADSync | |
$connector = (Get-ADSyncConnector | Where-Object {$_.Name -ilike "*AAD"}).Name | |
Get-ADSyncAADPasswordResetConfiguration -Connector $connector | |
Set-ADSyncAADPasswordResetConfiguration -Connector $connector -Enable:$true |
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-Module ADSync | |
$connector = (Get-ADSyncConnector | Where-Object {$_.Name -ilike "*AAD"}).Name | |
Get-ADSyncAADPasswordResetConfiguration -Connector $connector | |
Set-ADSyncAADPasswordResetConfiguration -Connector $connector -Enable:$false |
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
# Show all | |
Get-ADUser -ldapFilter '(msExchMailboxGuid=*)' -Properties mail,UserPrincipalName,ProxyAddresses | | |
Select UserPrincipalName,mail,@{N="PrimarySmtpAddress";E={($_.proxyAddresses | Where {$_ -clike "SMTP:*"}).Split(":")[1]}} | |
# Show only where there is a mismatch | |
Get-ADUser -ldapFilter '(msExchMailboxGuid=*)' -Properties mail,UserPrincipalName,ProxyAddresses | | |
Select UserPrincipalName,mail,@{N="PrimarySmtpAddress";E={($_.proxyAddresses | Where {$_ -clike "SMTP:*"}).Split(":")[1]}} | | |
Where { | |
($_.mail.ToString() -ne $_.userPrincipalName.ToString()) -or | |
($_.mail.ToString() -ne $_.PrimarySmtpAddress.ToString()) -or |
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
<# | |
.SYNOPSIS | |
TODO: Add scripts synopsis here | |
.DESCRIPTION | |
TODO: Add script description here. This should be a longer version of the synopsis | |
.OUTPUTS | |
What are the output types? |
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 DownloadFilesFromRepo { | |
Param( | |
[string]$Owner, | |
[string]$Repository, | |
[string]$Path, | |
[string]$DestinationPath | |
) | |
$baseUri = "https://api.github.com/" | |
$args = "repos/$Owner/$Repository/contents/$Path" |
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
# https://blog.codinghorror.com/why-cant-programmers-program/ | |
function FizzBuzz { | |
0..100 | % { | |
if ( ( $_ % 3 -eq 0 ) -and ( $_ % 5 -eq 0 ) ) { | |
"$_ fizzbuzz" | |
} elseif ( $_ % 3 -eq 0) { | |
"$_ fizz" | |
} elseif ( $_ % 5 -eq 0) { | |
"$_ buzz" | |
} 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
$urls = @( | |
"http://mysite.com", | |
"https://mysite.com.au/" | |
) | |
$tries = 100 | |
foreach ($url in $urls) { | |
$targets = @() |