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
[CmdletBinding()] | |
Param ( | |
[Parameter(Mandatory=$True, ValueFromPipeline=$True, HelpMessage="Enter an email address to compute hash")] | |
[ValidateScript({If ($_ -match "\b[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\.)+[A-Z]{2,4}\b") {$True} | |
Else {Throw "The email address $_ is not a valid email address format."}})] | |
[String[]]$Email | |
) |
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
Begin {} #Begin | |
Process | |
{ | |
Write-Verbose ("The following email addresses have been specified " + ($Email -join ',') + ".") | |
ForEach ($String in $Email) | |
{ | |
Write-Verbose ("Computing hash for the email address " + $String+ ".") | |
$StringBuilder = New-Object System.Text.StringBuilder | |
[System.Security.Cryptography.HashAlgorithm]::Create("MD5").ComputeHash([System.Text.Encoding]::UTF8.GetBytes($String))| ForEach-Object { |
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
[CmdletBinding()] | |
Param ( | |
[Parameter(Mandatory=$True, ValueFromPipeline=$True, HelpMessage="Enter an email address to compute hash")] | |
[ValidateScript({If ($_ -match "\b[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\.)+[A-Z]{2,4}\b") {$True} | |
Else {Throw "The email address $_ is not a valid format."}})] | |
[String[]]$Email, | |
[ValidateSet('MD5','RIPEMD160','SHA1','SHA256','SHA384','SHA512')] | |
[String] $HashAlgorithm = "MD5" | |
) |
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
Begin {} #Begin | |
Process | |
{ | |
Write-Verbose ("The following email addresses have been specified " + ($Email -join ',') + ".") | |
ForEach ($String in $Email) | |
{ | |
Write-Verbose ("Computing hash for the email address " + $String + " using the " + $HashAlgorithm + " algorithm.") | |
$StringBuilder = New-Object System.Text.StringBuilder | |
[System.Security.Cryptography.HashAlgorithm]::Create($HashAlgorithm).ComputeHash([System.Text.Encoding]::UTF8.GetBytes($String))| ForEach-Object { |
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
[CmdletBinding()] | |
Param( | |
[Parameter(Mandatory=$true)][ValidateScript({Get-Item $_})][String[]] $Certificates, | |
[String] $Output = ([Environment]::GetEnvironmentVariable("UserProfile")) + "\container_file.pem" | |
) |
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
Process | |
{ | |
Try | |
{ | |
# Retrieves and adds the content of each certificate from the specified location to a concatenated certificate container file. | |
ForEach ($Certificate in $Certificates) | |
{ | |
Get-Content $Certificate | Add-Content $Output | |
} | |
} # Try |
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
ConvertTo-CertificateContainer -Certificates "C:\Certificates\SSL.crt", "C:\Certificates\IntermediateCA.crt", "C:\Certificates\RootCA.crt" -Output C:\Certificates\chain.pem -Verbose |
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
[CmdletBinding()] | |
Param ( | |
[String] $Days = "1", | |
[Switch] $Microsoft, | |
[Switch] $NVD, | |
[String] $Keywords = "Ubuntu|Tomcat|MySQL" | |
) |
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
Try | |
{ | |
# Conditional logic to determine if the switch to retrieve information from the Microsoft Security Bulletin RSS feed has been specified. | |
If ($Microsoft) | |
{ | |
# Retrieves content from the Microsoft Security Bulletin RSS feed. | |
[xml]$WebRequest = Invoke-WebRequest -Uri https://technet.microsoft.com/en-us/security/rss/bulletin | |
# Selects objects retrieved where the published date is greater or equal to the timespan speficied. | |
$Items = $WebRequest.rss.channel.item | Where-Object {$_.pubDate -ge "$Date"} | |
# Performs action on each item returned to calculate expressions for output object. |
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
# http://powershell.org/wp/2015/12/05/december-2015-scripting-games-puzzle/ | |
$List = @" | |
1 Partridge in a pear tree | |
2 Turtle Doves | |
3 French Hens | |
4 Calling Birds | |
5 Golden Rings | |
6 Geese a laying | |
7 Swans a swimming |