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, |
View ConvertTo-X509Certificate.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 | |
using namespace System.Security.Cryptography.X509Certificates | |
function ConvertTo-X509Certificate { | |
<# | |
.SYNOPSIS | |
Convert a Base64 encoded certificate (with header and footer) to an X509Certificate object. | |
.DESCRIPTION | |
ConvertTo-X509Certificate reads a Base64 encoded certificate string or file and converts it to an X509Certificate object. | |
.EXAMPLE |
View Get-TaskStartDate.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-TaskStartDate { | |
<# | |
.SYNOPSIS | |
Get a start date from a string expression. | |
.DESCRIPTION | |
Finds the start date from a string expression. | |
.EXAMPLE | |
Get-TaskStartDate -Day '1st Monday' |
View Test-RpcPort.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 Test-RpcPort { | |
<# | |
.SYNOPSIS | |
Enumerates and tests connectivity to the RPC ports on the target server. | |
.DESCRIPTION | |
Enumerates and tests connectivity to the RPC ports on the target server. | |
Rebuilt from https://gallery.technet.microsoft.com/Test-RPC-Testing-RPC-4396fcda | |
#> |
View Split-DistinguishedName.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 Split-DistinguishedName { | |
<# | |
.SYNOPSIS | |
Split a distinguishedName into named pieces. | |
.DESCRIPTION | |
Split a distinguishedName into Name, ParentDN, ParentName, and DomainComponent. | |
.EXAMPLE | |
Split-DistinguishedName 'OU=somewhere,DC=domain,DC=com' |
View Get-ADAttributeAlias.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-ADAttributeAlias { | |
<# | |
.SYNOPSIS | |
Gets the names of the aliased attributes from the ActiveDirectory module. | |
.DESCRIPTION | |
Users reflection to discover the names of the attribute aliases available to filters. | |
View Convert-ADFilter.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 module ActiveDirectory | |
using namespace System.Reflection | |
function Convert-ADFilter { | |
<# | |
.SYNOPSIS | |
Converts PowerShell-style filters used by the AD module into LDAP filters. | |
.DESCRIPTION | |
Convert-ADFilter uses the QueryParser from the AD module to convert PowerShell-style filters into LDAP |
View Export-EventLog.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 Export-EventLog { | |
<# | |
.SYNOPSIS | |
Export an event log to a saved event log file. | |
.DESCRIPTION | |
Export an event log, and it's messages, to a named event log file. | |
.EXAMPLE | |
Get-WinEvent -ListLog Application | Export-EventLog |
NewerOlder