Skip to content

Instantly share code, notes, and snippets.

View chrisbrownie's full-sized avatar
🛩️
computering

Chris Brown chrisbrownie

🛩️
computering
View GitHub Profile
$Servers = Get-ExchangeServer | ? IsE15OrLater | Select -exp Name
Get-Service -ComputerName $servers -Name “MSExchangeIMAP4”,”MSExchangeIMAP4BE” | Set-Service -StartupType Automatic
Get-Service -ComputerName $servers -Name “MSExchangeIMAP4”,”MSExchangeIMAP4BE” | Start-Service
// From https://gist.github.com/mathiasbynens/428626
document.head || (document.head = document.getElementsByTagName('head')[0]);
function changeFavicon(src) {
var link = document.createElement('link'),
oldLink = document.getElementById('dynamic-favicon');
link.id = 'dynamic-favicon';
link.rel = 'icon';
link.href = src;
if (oldLink) {
Set-AdfsWebTheme -TargetName "yourcustomtheme" -AdditionalFileResource
@{
Uri="/adfs/portal/script/onload.js"
Path="C:\adfs\assets\theme\script\onload.js"
}, @{
Uri="/adfs/portal/logo/favicon.ico"
Path="C:\adfs\assets\script\onload.js"
}

Keybase proof

I hereby claim:

  • I am chrisbrownie on github.
  • I am chrisbrown (https://keybase.io/chrisbrown) on keybase.
  • I have a public key ASBrRkX0CgLOjIiyihAbRRW6TZSlZPPKVDphaNGOKWABUAo

To claim this, I am signing this object:

# Because we all know loading up an already overwhelmed site helps #Census
$url = "https://ebgames.com.au/featured/nintendo-classic-mini-nes"
$passes = 0
$fails = 0
while ($true) {
try {
iwr $url -ErrorAction "STOP" -Verbose:$false | Out-Null
@chrisbrownie
chrisbrownie / MonitorRedirects.ps1
Created November 16, 2016 05:45
Evaluates redirects being returned by one or more URLs. Good for troubleshooting load balancers.
$urls = @(
"http://mysite.com",
"https://mysite.com.au/"
)
$tries = 100
foreach ($url in $urls) {
$targets = @()
@chrisbrownie
chrisbrownie / FizzBuzz.ps1
Created December 4, 2016 11:39
My PowerShell solution to the fizzbuzz question https://blog.codinghorror.com/why-cant-programmers-program/
# 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 {
@chrisbrownie
chrisbrownie / DownloadFilesFromRepo.ps1
Created December 6, 2016 21:21
PowerShell function to download files from a GitHub repository
function DownloadFilesFromRepo {
Param(
[string]$Owner,
[string]$Repository,
[string]$Path,
[string]$DestinationPath
)
$baseUri = "https://api.github.com/"
$args = "repos/$Owner/$Repository/contents/$Path"
<#
.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?
@chrisbrownie
chrisbrownie / Get-MailAttributes.ps1
Created December 14, 2016 23:49
Gets UPN, Mail, and primary SMTP address (from proxyAddresses)
# 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