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
<# | |
.Synopsis | |
Generate one or more random passwords, from 7 to 64 characters in length. | |
.Description | |
Passwords are generated using an equal distribution of upper and lower case letters, numbers, space, and special | |
characters found on the number row. | |
.Parameter Length | |
Specifies the length of the generated password(s). |
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
#Requires -Version 3 | |
function ConvertFrom-GuidToImmutableId ([Guid]$Guid){ | |
[System.Convert]::ToBase64String([Guid]::Parse($Guid).ToByteArray()) | |
} | |
New-Alias -Name g2i -Value ConvertFrom-GuidToImmutableId | |
function ConvertFrom-ImmutableIdToGuid ([string]$ImmutableId) { |
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
#Requires -Version 5.1 | |
using namespace System.Management.Automation.Host | |
switch ( | |
$host.UI.PromptForChoice( | |
"Caption (e.g. 'XYZ has come up!')", | |
"Message (e.g. 'How would you like to proceed?", | |
[ChoiceDescription[]]@( |
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 ConvertFrom-SecureStringToPlainText ([System.Security.SecureString]$SecureString) { | |
[System.Runtime.InteropServices.Marshal]::PtrToStringAuto( | |
[System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($SecureString) | |
) | |
} | |
New-Alias -Name s2p -Value ConvertFrom-SecureStringToPlainText |
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
# For documentation purposes, sometimes I need fake thumbprints (and Guid's). | |
function New-FakeThumbprint ([ValidateRange(1, 10)][int]$Count = 1) { | |
1..$Count | ForEach-Object { | |
( | |
1..40 | Foreach-Object { | |
Get-Random @('A', 'B', 'C', 'D', 'E', 'F', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9') | |
} | |
) -join '' |
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
reg add HKCU\Software\Microsoft\Office\16.0\Outlook\AutoDiscover /v PreferLocalXML /t REG_DWORD /d 0 | |
reg add HKCU\Software\Microsoft\Office\16.0\Outlook\AutoDiscover /v ExcludeHttpRedirect /t REG_DWORD /d 0 | |
reg add HKCU\Software\Microsoft\Office\16.0\Outlook\AutoDiscover /v ExcludeHttpsAutoDiscoverDomain /t REG_DWORD /d 0 | |
reg add HKCU\Software\Microsoft\Office\16.0\Outlook\AutoDiscover /v ExcludeHttpsRootDomain /t REG_DWORD /d 0 | |
reg add HKCU\Software\Microsoft\Office\16.0\Outlook\AutoDiscover /v ExcludeScpLookup /t REG_DWORD /d 0 | |
reg add HKCU\Software\Microsoft\Office\16.0\Outlook\AutoDiscover /v ExcludeSrvRecord /t REG_DWORD /d 0 | |
reg add HKCU\Software\Microsoft\Office\16.0\Outlook\AutoDiscover /v ExcludeLastKnownGoodURL /t REG_DWORD /d 0 | |
reg add HKCU\Software\Microsoft\Office\16.0\Outlook\AutoDiscover /v ExcludeExplicitO365Endpoint /t REG_DWORD /d 0 |
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
# Backup all *.config files. | |
# Backup all supported OWA customization files: | |
# https://docs.microsoft.com/en-us/Exchange/clients/outlook-on-the-web/customize-outlook-on-the-web?view=exchserver-2016 | |
# https://docs.microsoft.com/en-us/Exchange/clients/outlook-on-the-web/customize-outlook-on-the-web?view=exchserver-2019 | |
$BackupLocation = "$HOME\Desktop\Exchange_pre-CU_Backup\" | |
$ExInstallRoot = 'C:\Program Files\Microsoft\Exchange Server\v15\' | |
$OwaAuthDir = '\FrontEnd\HttpProxy\owa\auth\' | |
$OwaPremDir = '\ClientAccess\Owa\prem\' |
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
using namespace System | |
using namespace System.Runtime.InteropServices | |
########-----------# | |
#region# Variables # | |
########-----------# | |
try { | |
$Cred1 = Import-Clixml "$($HOME)\Cred1.xml" -ErrorAction Stop | |
Write-Information -MessageData "`$Cred1: $($Cred1.UserName)" -InformationAction Continue |
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
<# | |
.Synopsis | |
This is not intended to be an executable script. It's PS1 for now simply for syntax highlighting. | |
#> | |
#======#---------------------------# | |
#region# Backup LegacyExchangeDN's # | |
#======#---------------------------# | |
$LDNRecipients = @() | |
$Recipients = @() |
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 ConvertFrom-DistinguishedName ($DistinguishedName) { | |
$Domain = ($DistinguishedName -split ',DC=' | Where-Object { $_ -notmatch '^CN=' }) -join '.' | |
$CNPath = ($DistinguishedName -split ',DC=' | Where-Object { $_ -match '^CN=' }) -split ',\w\w=' | |
[array]::Reverse($CNPath) | |
($Domain + '/' + ($CNPath -join '/')) -replace 'CN=' -replace '\\' | |
} | |
ConvertFrom-DistinguishedName "CN=Bradshaw\, Jeremy,OU=PowerShell,DC=Sample,DC=code" |
OlderNewer