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 -Modules ActiveDirectory | |
function Get-ADUserPasswordExpiration | |
{ | |
param( | |
[Parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true)] | |
[Alias('DistinguishedName')] | |
[Microsoft.ActiveDirectory.Management.ADUser[]]$Identity | |
) |
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
$Properties = 'employeeID' | |
# Retrieve all workers with their "manager" attribute | |
Get-ADUser -Filter "title -like '*worker*'" -Properties @('manager';$Properties) |ForEach-Object { | |
# Iterate over workers, retrieve each workers manager individually | |
[pscustomobject]@{ | |
Worker = $_ | |
Manager = Get-ADUser -Identity $_.manager -Properties $Properties -ErrorAction SilentlyContinue | |
} | |
} |
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 Prompt | |
{ | |
Write-Host "[" -NoNewline | |
Write-Host (Get-Date -Format "HH:mm:ss") -ForegroundColor Gray -NoNewline | |
try | |
{ | |
$history = Get-History -ErrorAction Ignore | |
if ($history) | |
{ |
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
write-output "This is a pre-commit powershell call" | |
write-output "=======================================" | |
Import-Module -Name PSScriptAnalyzer | |
$changes = git diff --name-only | |
$output = @() | |
foreach ($change in $changes) | |
{ |
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 ConvertTo-Base64KMSEncryptedString { | |
[CmdletBinding()] | |
param ( | |
[Parameter( | |
Mandatory = $true, | |
ValueFromPipeline = $true | |
)] | |
[String[]] | |
$String, |
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
Import-Module Polaris -Verbose | |
Import-Module PSHTML -Verbose | |
Add-Type -AssemblyName System.Web | |
New-PolarisGetRoute -Path "/Login" -Scriptblock { | |
$HTML = html { | |
head { | |
Title "Login Page" | |
} |
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.Net.Http | |
#requires -version 7.2 | |
# This is the bootstrap script for Modules | |
[CmdletBinding(PositionalBinding = $false)] | |
param ( | |
#Specify a specific release to use, otherwise 'latest' is used | |
[string]$Release = 'latest', | |
#Specify the user | |
[string]$User = 'JustinGrote', | |
#Specify the repo |
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
# 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 |
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
[CmdletBinding(DefaultParameterSetName='Version')] | |
param | |
( | |
[Parameter(ParameterSetName='Latest', Mandatory = $true)] | |
[Parameter(ParameterSetName='Version', Mandatory = $true)] | |
[String] | |
$SaveToPath, | |
[Parameter(ParameterSetName='Version', Mandatory = $true)] | |
[String] |
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 Get-AzSpotPrice { | |
[CmdletBinding()] | |
param ( | |
#VM SKU (e.g. Standard_F8s) | |
[String]$Sku, | |
#Azure Region (e.g. brazilsouth) | |
[String]$Region, | |
#ODATA filter to use on the data | |
[String]$Filter, | |
#Maximum number of records to retrieve, or specify 'Unlimited' for all records. Defaults to 100. This behaves like the Exchange Cmdlets |