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 Connect-ExchangeOnline() { | |
Param( | |
$Credential = $(Get-Credential) | |
) | |
if (-not $global:eoSession) { | |
$Global:eoSession = New-PSSession ` | |
-ConfigurationName Microsoft.Exchange ` | |
-ConnectionUri "https://outlook.office365.com/powershell-liveid" ` |
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
$uri = "https://flamingkeys.com" | |
while ($true) { | |
try { | |
Invoke-WebRequest $uri -TimeoutSec 5 | |
start "https://www.youtube.com/watch?v=xos2MnVxe-c" | |
break | |
} catch { |
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
#EmailWhenUp.ps1 | |
# Usage: ./EmailWhenUp.ps1 Computer01 | |
Param([string]$ComputerName,[string]$mailServer,[string]$MailTo) | |
function isup { | |
Param([string]$ComputerName) | |
Test-Connection -ComputerName $ComputerName -Count 1 -Quiet | |
} |
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
# Downloads all aero charts from Airservices | |
$hostUri = "http://www.airservicesaustralia.com/aip/current/dap/AeroProcChartsTOC.htm" | |
$fileTypesToDownload = @("pdf") | |
# Download the page of charts | |
$links = Invoke-WebRequest $hostUri | select -ExpandProperty links | |
# Get a webclient ready for downloading files | |
$webClient = New-Object System.Net.WebClient | |
foreach ($link in $links) { |
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
# Moved to Github: https://github.com/chrisbrownie/Convert-ExcelSheetToJson |
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
'====================================================================== | |
' GetDistributionGroups.vbs | |
'====================================================================== | |
' Author: Chris Brown ([email protected]) | |
' Date: 09/10/2014 | |
' Details: Returns all mail-enabled groups in the domain | |
' Source: Unknown (I forget if I wrote this myself or found it somewhere) | |
'====================================================================== | |
' Everything below this will be searched. Must be in the format |
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
'====================================================================== | |
' ListAllSMTPAddresses.vbs | |
'====================================================================== | |
' Author: Chris Brown ([email protected]) | |
' Date: 07/10/2014 | |
' Details: Returns all SMTP proxy addresses for all users in a given | |
' domain or OU in CSV format | |
' Source: Unknown (I forget if I wrote this myself or found it somewhere) | |
' | |
' |
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-RandomNumber ([int]$min,[int]$max,[switch]$leadingZeroes) { | |
$number = Get-Random -Minimum $min -Maximum $max | |
if ($leadingZeroes) { | |
if ($number.ToString().Length -lt $max.ToString().Length) { | |
$number.Tostring().PadLeft($max.ToString().Length,"0") | |
} else { | |
$number.ToString() | |
} | |
} else { | |
$number.ToString() |
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 AddOrUpdateTextInFile() { | |
Param( | |
$File, | |
[string]$StartString, | |
[string]$EndString, | |
[string]$ReplacementString | |
) | |
$fileContent = Get-Content $File -ReadCount 512 | |
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
New-TransportRule -Name "Encrypt mail from the Security team" ` | |
-RuleErrorAction Defer ` | |
-FromMemberOf '[email protected]' ` | |
-SetAuditSeverity Low ` | |
-ApplyOME $true |