Skip to content

Instantly share code, notes, and snippets.

View brettmillerb's full-sized avatar
🏠
Working from home

Brett Miller brettmillerb

🏠
Working from home
View GitHub Profile
@brettmillerb
brettmillerb / New-ObjectAttribute.ps1
Created August 25, 2020 23:27
Mindville API object functions
function New-ObjectAttribute {
[CmdletBinding()]
param (
[string]
$AttributeId,
[string]
$ObjectAttributeValue
)
@brettmillerb
brettmillerb / AddLocationsToOD4BRetentionPolicyException.ps1
Last active August 25, 2020 14:35
OD4BRetentionPolicyException
<#
.SYNOPSIS
Adds Users OneDrives to a O365 Retention Policy exception list
.DESCRIPTION
Takes a CSV list of Users OneDrive urls and adds them to the specified O365 Retention Policy
exception list.
.PARAMETER
None
.EXAMPLE
None
@brettmillerb
brettmillerb / Export-AzKeyVaultCertficate.ps1
Last active May 23, 2022 18:20
Export-AzKeyVaultCertficate.ps1
function Export-AzKeyVaultCertificate {
[CmdletBinding()]
param (
[parameter(Mandatory)]
[string]
$VaultName,
[Parameter(Mandatory)]
[string]
$CertName,
@brettmillerb
brettmillerb / Get-ElasticPoolsForMigration.ps1
Last active August 20, 2020 15:18
ElasticPool Migration to vCore
[CmdletBinding()]
param (
[int]
$MigrationLimit = 1
)
$connectionName = "connectionName"
try {
# Get the connection "AzureRunAsConnection" You can't use the Az module version for reasons.
$servicePrincipalConnection = Get-AutomationConnection -Name $connectionName
function Test-DivisibleByThree {
[CmdletBinding()]
[OutputType([String])]
Param (
[Parameter(Mandatory=$true,
ValueFromPipeline = $true,
ValueFromPipelineByPropertyName = $true)]
$String
)
@brettmillerb
brettmillerb / HowTo.md
Last active August 28, 2020 23:54
Teams JSON String Creation of Teams Webhook Content

I wanted a way to dynamically build output in Azure Automation for a database migration.

# Create the internal sections first with ElasticPoolName and databases joined with \n\n (new line in Teams)
$sections = $dbsPerElasticPool | ForEach-Object {
    New-TeamsSection -ActivityTitle ('ElasticPool: **{0}**' -f $_.ElasticPool) -Value ($_.databases -join '\n\n')
}

# Create the rest of the card with the sections
$card = New-TeamsMessageCard -Sections $sections | ConvertTo-Json -Depth 5
@brettmillerb
brettmillerb / zshrc-theme
Last active August 25, 2022 06:09
.zshrc | macOs
# Path to your oh-my-zsh installation.
export ZSH="/Users/brett.miller/.oh-my-zsh"
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
# Set name of the theme to load
ZSH_THEME="powerlevel9k/powerlevel9k"
DISABLE_AUTO_TITLE="true"
# Plugins
@brettmillerb
brettmillerb / Example.md
Created June 16, 2020 21:34
Splunk New-SearchQuery
$newSearchQuerySplat = @{
    index = 'sitescope3' 
    SlAppId = 'alteryx' 
    SlStatusMessage = 'cpu', 'memory' 
    SlMonName = 'prod' 
    SourceType = 'sitescope' 
    HostName = 'hidden'
}
@brettmillerb
brettmillerb / EditorServicesCommandSuiteError.ps1
Last active June 15, 2020 12:50
Error for EditorServicesCommandSuite MacOS
System.Management.Automation.MethodInvocationException: Exception calling "ProcessRecord" with "1" argument(s): "Method not found: 'Int64 Microsoft.PowerShell.EditorServices.Extensions.ILspFilePosition.get_Line()'."
---> System.MissingMethodException: Method not found: 'Int64 Microsoft.PowerShell.EditorServices.Extensions.ILspFilePosition.get_Line()'.
at EditorServicesCommandSuite.EditorServices.ContextService.GetDocumentContextAsync(PSCmdlet cmdlet, CancellationToken cancellationToken, ThreadController threadController)
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
at EditorServicesCommandSuite.EditorServices.ContextService.GetDocumentContextAsync(PSCmdlet cmdlet, CancellationToken cancellationToken, ThreadController threadController)
at EditorServicesCommandSuite.Internal.RefactorCmdletAdapter.<>c__DisplayClass12_0.<<InvokeRefactor>b__0>d.MoveNext() in D:\a\1\s\src\EditorServicesCommandSuite\Internal\RefactorCmdletAdapter.cs:line 126
@brettmillerb
brettmillerb / sparse-checkout.md
Last active April 24, 2020 15:05
Sparse-Checkout

Create a directory on your local machine

PS > New-Item -ItemType Directory -Name SharePointOnline-ScriptSamples

Directory: /Users/brett.miller/git/gitpersonal
Mode       LastWriteTime        Length Name
----       ------------ -       ------ ----
d----       24/04/2020  15:03          SharePointOnline-ScriptSamples