Skip to content

Instantly share code, notes, and snippets.

🤠
It's a sweet day to write some Powershell

Stephen Valdinger steviecoaster

🤠
It's a sweet day to write some Powershell
Block or report user

Report or block steviecoaster

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Start-Streaming.ps1
#ensure chocolatey is Installed
If(-not (Test-Path $env:ChocolateyInstall)){
Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process
iex (New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/Install.ps1')
}
refreshenv
View ConvertFrom-StringData Changes.md

Example 9: Use a different delimiter to split a string into a hashtable

$Here = @'
Msg1 : The string parameter is required.
Msg2 : Credentials are required for this command.
Msg3 : The specified variable does not exist.
'@
ConvertFrom-StringData -StringData $Here -Delimiter ':'
@steviecoaster
steviecoaster / Get-DadJokeSound.ps1
Created Aug 30, 2019
Get-DadJokes.....WITH SOUND!!!!
View Get-DadJokeSound.ps1
function Get-DadJoke {
[cmdletBinding()]
Param()
process {
$header = @{
Accept = "application/json"
}
$joke = Invoke-RestMethod -Uri "https://icanhazdadjoke.com/" -Method Get -Headers $header
@steviecoaster
steviecoaster / Get-DadJoke.ps1
Created Aug 19, 2019
Because dad jokes are always fun.
View Get-DadJoke.ps1
function Get-DadJoke {
[cmdletBinding()]
Param()
process {
$header = @{
Accept = "application/json"
}
$joke = Invoke-RestMethod -Uri "https://icanhazdadjoke.com/" -Method Get -Headers $header
$joke.joke
@steviecoaster
steviecoaster / Remove-ChocoLog.ps1
Created Jul 23, 2019
Remove a chocolatey log that has grown unruly in size
View Remove-ChocoLog.ps1
function Remove-ChocoLog {
<#
.SYNOPSIS
Remove a chocolatey log from a system
.DESCRIPTION
Based on size threshold, will remove a chocolatey.log file from the specified system(s).
.PARAMETER LogThresholdMB
Size in MB to determine whether or not to prune a log
@steviecoaster
steviecoaster / Get-ChocoLogSize.ps1
Created Jul 23, 2019
Query size of a chocolatey log
View Get-ChocoLogSize.ps1
function Get-ChocoLogSize {
<#
.SYNOPSIS
Returns the size of the chocolatey.log file in MB
.PARAMETER Computername
The system to query. Defaults to the local COMPUTERNAME
.EXAMPLE
Get-ChocoLogSize
View ConvertTo-ChocoObject.ps1
function ConvertTo-ChocoObject {
[CmdletBinding()]
Param (
[Parameter(ValueFromPipeline)]
[string]$InputObject
)
Process {
# format of the 'choco list' output is:
# <PACKAGE NAME> <VERSION> (ie. adobereader 2015.6.7)
@steviecoaster
steviecoaster / Open-ChocolateyRepoUrl.ps1
Last active Feb 11, 2019
Interact with the chocolatey community repository directly in Powershell
View Open-ChocolateyRepoUrl.ps1
function Open-ChocolateyRepoUrl {
<#
.SYNOPSIS
Open Chocolatey repo urls directly from Powershell
.PARAMETER Search
The term to search for on the repo
.PARAMETER PackageName
View gist:c4a6fe2532d5f8ff03e7a8f784a311e6
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 / ConvertTo-Base64.ps1
Last active Jan 7, 2019
Convert a string to Base64
View ConvertTo-Base64.ps1
using namespace System.Management.Automation
using namespace System.Text
class EncodingTransformAttribute : ArgumentTransformationAttribute {
[object] Transform([EngineIntrinsics]$engineIntrinsics, [object] $inputData) {
switch ($inputdata) {
{ $_ -is [System.Text.Encoding]} {
You can’t perform that action at this time.