Skip to content

Instantly share code, notes, and snippets.

View steviecoaster's full-sized avatar
🤠
It's a sweet day to write some Powershell

Stephen Valdinger steviecoaster

🤠
It's a sweet day to write some Powershell
View GitHub Profile
@steviecoaster
steviecoaster / Get-BitlockerEncryptionToast.ps1
Created November 16, 2018 18:27
Get a toast on Windows 10 when a workstation finishes encrypting with Bitlocker
Function Get-BitlockerEncryptionToast {
[cmdletBinding()]
Param(
[Parameter(ValueFromPipeline, ValueFromPipelineByPropertyName)]
[string]
$Computername
)
Start-Job -ScriptBlock {
@steviecoaster
steviecoaster / New-DotNetToast.ps1
Created November 16, 2018 19:48
Create a WIndows 10 Toast notification using .Net
Function New-DotNetToast {
[cmdletBinding()]
Param(
[Parameter(Mandatory, Position = 0)]
[String]
$Title,
[Parameter(Mandatory,Position = 1)]
[String]
$Message,
@steviecoaster
steviecoaster / azure-pipelines.yml
Last active November 29, 2018 14:39
Azure Pipelines yaml config
resources:
- repo: self
queue:
name: Hosted Windows Container
#Your build pipeline references a secret variable named ‘GithubKey’. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab, and then select the option to make it secret. See https://go.microsoft.com/fwlink/?linkid=865972
#Your build pipeline references an undefined variable named ‘BlogUrl’. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab. See https://go.microsoft.com/fwlink/?linkid=865972
steps:
- powershell: ./'Invoke-PagesBuild.ps1'
arguments: '$(GithubKey)'
@steviecoaster
steviecoaster / Invoke-PagesBuild.ps1
Created November 18, 2018 23:25
Azure Pipelines Powershell Build Script
<#
.SYNOPSIS
Sends a request to the Github Pages API to trigger a Pages build for the repository.
.DESCRIPTION
Uses Invoke-WebRequest method to send a POST request to the Github Pages API. This request is directed at the repository
API URL, and requires an OAuth token with appropriate permissions to be specified in order for the request to be
accepted by the API.
.PARAMETER Token
Specify the OAuth API Token with which to query the Github API. If a token is not provided, or the provided token does
not have sufficient permissions, the request will typically respond with a 404 error for any non-publicly-available
@steviecoaster
steviecoaster / Find-Event.ps1
Created November 29, 2018 21:44
Find-Event
Function Find-Event {
<#
.SYNOPSIS
Find specific event in the log on specified computer(s)
.PARAMETER Computer
The machine or machines you wish to query
.PARAMETER Logname
The log in which to look for IDs
@steviecoaster
steviecoaster / Start-Deployment.ps1
Last active December 5, 2018 22:05
PDQ Deploy bootstrap script
Function Start-Deployment {
<#
.SYNOPSIS
Start a PDQ Deploy Deployment on a target machine
.DESCRIPTION
Trigger a PDQ Deploy deployment to start locally or on a remote machine with PDQ Deploy installed
.EXAMPLE
Start-Deployment -PackageName "Example Package" -Targets "Wolverine"
@steviecoaster
steviecoaster / ConvertFrom-Base64String.ps1
Last active January 7, 2019 02:54
Converts a Base64 string into something usable
using namespace System.Management.Automation
using namespace System.Text
class EncodingTransformAttribute : ArgumentTransformationAttribute {
[object] Transform([EngineIntrinsics]$engineIntrinsics, [object] $inputData) {
switch ($inputdata) {
{ $_ -is [System.Text.Encoding]} {
@steviecoaster
steviecoaster / ConvertTo-Base64.ps1
Last active January 7, 2019 03:35
Convert a string to Base64
using namespace System.Management.Automation
using namespace System.Text
class EncodingTransformAttribute : ArgumentTransformationAttribute {
[object] Transform([EngineIntrinsics]$engineIntrinsics, [object] $inputData) {
switch ($inputdata) {
{ $_ -is [System.Text.Encoding]} {
Once upon a midnight dreary, while I pondered, weak and weary,
Over many a quaint and curious volume of forgotten lore—
While I nodded, nearly napping, suddenly there came a tapping,
As of some one gently rapping, rapping at my chamber door.
“’Tis some visitor,” I muttered, “tapping at my chamber door—
Only this and nothing more.”
Ah, distinctly I remember it was in the bleak December;
And each separate dying ember wrought its ghost upon the floor.
Eagerly I wished the morrow;—vainly I had sought to borrow
@steviecoaster
steviecoaster / Open-ChocolateyRepoUrl.ps1
Last active February 11, 2019 16:38
Interact with the chocolatey community repository directly in Powershell
function Open-ChocolateyRepoUrl {
<#
.SYNOPSIS
Open Chocolatey repo urls directly from Powershell
.PARAMETER Search
The term to search for on the repo
.PARAMETER PackageName