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
Describe "Debugging Examples" { | |
It 'Labs get Treats' { | |
$recommendedTreat = & $PSScriptRoot/Get-DogTreat.ps1 -DogBreed 'Labrador' -SuperBugged | |
$recommendedTreat.Calories | Should -BeGreaterThan 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
function Get-InstalledModuleFast { | |
param( | |
#Modules to filter for. Wildcards are supported. | |
[string]$Name, | |
#Path(s) to search for modules. Defaults to your PSModulePath paths | |
[string[]]$ModulePath = ($env:PSModulePath -split [System.IO.Path]::PathSeparator), | |
#Return all installed modules and not just the latest versions | |
[switch]$All | |
) |
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 Invoke-GhAction { | |
param( | |
$RepoName, | |
$Path, | |
$Method = 'GET', | |
$Body, | |
$BaseUri = 'https://api.github.com/repos' | |
) | |
$irmParams = @{ |
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 New-AzureDeploy { | |
<# | |
.SYNOPSIS | |
Creates an Azure Deploy Button link for a given ARM template. | |
#> | |
param( | |
#Path to the ARM json template file that is publicly hosted and accessible. This cannot be a bicep template. | |
[string]$Uri, | |
#Path to a UI Definition JSON file. https://aka.ms/masandbox to create one. | |
[string]$FormDefinitionUri |
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
param workspaceName string | |
param logRetentionDays int = 90 | |
param tableNames array = [ | |
'ASimNetworkSessionLogs' | |
'ASimAuthenticationEventLogs' | |
'ASimWebSessionLogs' | |
'ASimAuditEventLogs' | |
'ASimDhcpEventLogs' | |
'ASimDnsActivityLogs' | |
'ASimFileEventLogs' |
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.Collections.Generic | |
using namespace System.Management.Automation | |
using namespace System.Text | |
Function Send-AzMonitorLog { | |
[CmdletBinding()] | |
param( | |
[Parameter(Mandatory)] | |
[string]$Endpoint, |
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 Watch-UBreakIFix ($TrackingCode) { | |
while ($true) { | |
$result = foreach ($code in $TrackingCode) { | |
$response = Invoke-RestMethod "https://www.ubreakifix.com/api/v1/tracker/info?code=$code" | |
$status = $response.work_orders.work_order_status | |
[PSCustomObject]@{ | |
'Customer' = $response.customer.full_name | |
'Device' = $response.work_orders.device.device_type.name | |
'Fixer' = $response.user.email | |
'Status' = $status.name |
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 -Module Az.Accounts | |
$verbosePreference = 'continue' | |
function ConvertFrom-JWTtoken { | |
<# | |
.NOTES | |
Lovingly borrowed from: https://www.michev.info/blog/post/2140/decode-jwt-access-and-id-tokens-via-powershell | |
#> | |
[cmdletbinding()] | |
param([Parameter(Mandatory = $true)][string]$token) | |
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 -module Az.Functions | |
function Write-CmdletError { | |
param($message, $cmdlet = $PSCmdlet) | |
$cmdlet.ThrowTerminatingError( | |
[Management.Automation.ErrorRecord]::new( | |
$message, | |
'CmdletError', | |
'InvalidArgument', |
NewerOlder