View Register-Advice.tests.ps1
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 PSKoans | |
Describe "Register-Advice" { | |
BeforeAll { | |
$module = @{ | |
ModuleName = 'PSKoans' | |
} | |
} | |
Context "Profile Folder/File Missing" { |
View SystemTray.ps1
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
enum Visibility : byte { | |
Default = 0 | |
Hide = 1 | |
Show = 2 | |
} | |
function Convert-CeaserCipher { | |
<# | |
.SYNOPSIS | |
Convert a string to and from a ceaser cipher (ROT-13) encoding. |
View ADDns.ps1
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
############################################################################################################################################################## | |
# IANA # | |
############################################################################################################################################################## | |
# | |
# Address family | |
# | |
New-Enum -ModuleBuilder $IndentedDnsMB -Name "Indented.Dns.IanaAddressFamily" -Type "UInt16" -Members @{ | |
IPv4 = 1; # IP version 4 |
View CreatePackage.ps1
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
# Chocolatey must be installed on all nodes which intend to use it | |
https://chocolatey.org/install#individual | |
# Make a folder called DhcpDaemon | |
New-Item DhcpDaemon -ItemType Directory | |
# Inside that folder, make a folder called Tools | |
# This will hold your installation files and an install script | |
New-Item DhcpDaemon\tools -ItemType Directory | |
# Make an install script |
View Watch-WinEvent.ps1
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-WinEvent { | |
<# | |
.SYNOPSIS | |
Watch for events matching a query in the event log. | |
.DESCRIPTION | |
Watch for events matching a query in the event log. | |
#> |
View Get-DhcpClientOption.ps1
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-DhcpClientOption { | |
[CmdletBinding()] | |
param ( ) | |
$adapters = Get-CimInstance Win32_NetworkAdapterConfiguration -Filter 'IPEnabled=TRUE AND DhcpEnabled=TRUE' | |
foreach ($adapter in $adapters) { | |
$params = @{ | |
LiteralPath = Join-Path 'HKLM:\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces' -ChildPath $adapter.SettingID | |
Name = 'DhcpInterfaceOptions' | |
} |
View Get-Manufacturer.ps1
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 Update-ManufacturerList { | |
<# | |
.SYNOPSIS | |
Updates the cached manufacturer list maintained by the IEEE. | |
.DESCRIPTION | |
Update-ManufacturerList attempts to download the assigned list of MAC address prefixes using Get-WebContent. | |
The return is converted into an XML format to act as the cache file for Get-Manufacturer. | |
.PARAMETER Source | |
By default, the manufacturer list is downloaded from http://standards.ieee.org/develop/regauth/oui/oui.txt. An alternate source may be specified if required. |
View Enable-ScriptAlias.ps1
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.Management.Automation.Language | |
function Enable-ScriptAlias { | |
<# | |
.SYNOPSIS | |
Replace all aliased commands in a script with the alias name. | |
.DESCRIPTION | |
Replace all aliased commands in a script with the alias name. |
View pushover-example.ps1
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
$request = @{ | |
Uri = 'https://api.pushover.net/1/messages.json' | |
Method = 'POST' | |
ContentType = 'application/x-www-form-urlencoded' | |
Body = @{ | |
token = 'abc123' | |
user = 'user123' | |
message = 'hello world' | |
} | |
} |
View ConvertFrom-StringData.ps1
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 ConvertFrom-StringData { | |
<# | |
.FORWARDHELPTARGETNAME Microsoft.PowerShell.Utility\ConvertFrom-StringData | |
#> | |
[CmdletBinding()] | |
param ( | |
[Parameter(Mandatory, Position = 1, ValueFromPipeline)] | |
[string]$StringData, |
NewerOlder