Skip to content

Instantly share code, notes, and snippets.

Dave Carroll thedavecarroll

Block or report user

Report or block thedavecarroll

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
@thedavecarroll
thedavecarroll / EventData.psm1
Last active Dec 7, 2019
Create New Windows Event Source (Provider) and Write Unnamed EventData
View EventData.psm1
function New-EventSource {
[CmdLetBinding()]
param(
[string]$EventLog,
[string]$Source
)
if ([System.Diagnostics.EventLog]::SourceExists($Source) -eq $false) {
try {
[System.Diagnostics.EventLog]::CreateEventSource($Source, $EventLog)
@thedavecarroll
thedavecarroll / Get-IanaPortNumberRegistry.ps1
Last active Dec 1, 2019
Get IANA Port Number Registry
View Get-IanaPortNumberRegistry.ps1
function Get-IanaPortNumberRegistry {
[CmdLetBinding()]
param(
[ValidateSet('TCP','UDP','SCTP','DCCP')]
[string[]]$Protocol,
[ValidateRange(0,65535)]
[int[]]$PortNumber,
[string]$ServiceName,
[switch]$RefreshCache,
[string]$AlternatePath
@thedavecarroll
thedavecarroll / 1 - SimpleFunctions.ps1
Last active Nov 21, 2019
IronScripter Challenge - November 15, 2019 - Beginner PowerShell Function
View 1 - SimpleFunctions.ps1
function ConvertTo-Celsius {
param($Fahrenheit)
($Fahrenheit - 32) * 5/9
}
function ConvertTo-Fahrenheit {
param($Celsius)
($Celsius * 9/5) + 32
}
@thedavecarroll
thedavecarroll / Get-RecycleBin.ps1
Last active Oct 31, 2019
IronScripter Challenge - October 30, 2019 - Raise the Dead
View Get-RecycleBin.ps1
function Get-RecycleBin {
[CmdletBinding()]
param(
[switch]$Usage
)
begin {
if ($PSEdition -eq 'Core' -And !$IsWindows) {
'This function only works on Windows.' | Write-Warning
return
@thedavecarroll
thedavecarroll / Get-Uname.ps1
Last active Oct 9, 2019
IronScripter Challenge October 8, 2019
View Get-Uname.ps1
function Get-Uname {
[CmdLetBinding(
DefaultParameterSetName='KernelName'
)]
param(
[Parameter(ParameterSetName='All')]
[Alias('a')]
[switch]$All,
[Parameter(ParameterSetName='KernelName')]
@thedavecarroll
thedavecarroll / Send-SiteMap.ps1
Created Aug 10, 2019
Send SiteMap to Search Engines
View Send-SiteMap.ps1
function Send-SiteMap {
[CmdLetBinding()]
param(
[Parameter(Mandatory,ValueFromPipeline)]
[ValidateNotNullOrEmpty()]
[ValidateScript({$_ -match '\/.+?.xml$'})]
[uri]$Uri,
[switch]$ShowEncodedUrl
)
@thedavecarroll
thedavecarroll / IronScripter-2019-06-28-Output.txt
Last active Jul 5, 2019
IronScripter Challenge June 28, 2019
View IronScripter-2019-06-28-Output.txt
KeyInterval: 1,12
Message: PracticePowerShellDaily
KeyInterval DecodedMessage
----------- --------------
1,1 PkTr2sz2*cF-raz7GuD4w6U#gctK3E@Bt1aYQPic%705ZvAeW6jePRfpmI)Hy^LoowCnbJdOSi9Mber#)ieU*f2Z6MSh7VuD5a(hsv8el1oWZO7lpKyJlDz$-jI@tT23Raikq=F&wB6c%Hly
1,2 PTrsz*c-rz7uDw6#gtKE@t1YQic70ZveWjeRfmIHyLowCbJOS9Mer)iU*2ZMS7VD5(hv8l1WZ7lKylD$-I@T2RakqF&B6%Hy
1,3 Pr22*-r7G4w#gK3BtYQc%5ZeWePpmHyoonbOSMb#)U*Z6h7D5hselWZlpJl$-@t3Rkq&wc%y
1,4 P2scFz74wgcE@aYc%Zv6jfpHyowJd9M#)*fMSuDhsl1O7yJ$-tTaiF&c%
1,5 Psz-ruD#gE@YQ70eWRfHywCOSerU*MSD5v8WZKy$-T2kqB6y
View Update-DockerImages.ps1
$DockerImages = @{
Path = 'function:global:Update-DockerImages'
Value = {
try {
Invoke-Expression -Command 'docker images --format "{{.Repository}}" | Where-Object {$_ -ne "<none>"} | Foreach-Object { docker pull $_ }'
}
catch {
Write-Error -ErrorRecord $_
}
}
@thedavecarroll
thedavecarroll / Get-GitLog.ps1
Last active Jun 16, 2019
A PowerShell function for reading the git log of a local repository which is returned as an array of PSCustomObjects.
View Get-GitLog.ps1
function Get-GitLog {
[CmdLetBinding(DefaultParameterSetName='Default')]
param (
[Parameter(ParameterSetName='Default',ValueFromPipeline,Mandatory)]
[Parameter(ParameterSetName='SourceTarget',ValueFromPipeline,Mandatory)]
[ValidateScript({Resolve-Path -Path $_ | Test-Path})]
[string]$GitFolder,
[Parameter(ParameterSetName='SourceTarget',Mandatory)]
@thedavecarroll
thedavecarroll / WindowsForms.psm1
Last active Dec 20, 2018
WindowsForms ad hoc module and an example script
View WindowsForms.psm1
# ----------------------------------------------------------------------------------------------------------------------
# Functions required to create PowerShell GUI using System.Windows.Forms
# ----------------------------------------------------------------------------------------------------------------------
#region load assemblies
try {
[Void][reflection.assembly]::loadwithpartialname('System.Windows.Forms')
[Void][reflection.assembly]::loadwithpartialname('System.Drawing')
}
catch {
You can’t perform that action at this time.