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
# For documentation purposes, sometimes I need fake thumbprints (and Guid's). | |
function New-FakeThumbprint ([ValidateRange(1, 10)][int]$Count = 1) { | |
1..$Count | ForEach-Object { | |
( | |
1..40 | Foreach-Object { | |
Get-Random @('A', 'B', 'C', 'D', 'E', 'F', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9') | |
} | |
) -join '' |
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-SecureStringToPlainText ([System.Security.SecureString]$SecureString) { | |
[System.Runtime.InteropServices.Marshal]::PtrToStringAuto( | |
[System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($SecureString) | |
) | |
} | |
New-Alias -Name s2p -Value ConvertFrom-SecureStringToPlainText |
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 -Version 5.1 | |
using namespace System.Management.Automation.Host | |
switch ( | |
$host.UI.PromptForChoice( | |
"Caption (e.g. 'XYZ has come up!')", | |
"Message (e.g. 'How would you like to proceed?", | |
[ChoiceDescription[]]@( |
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 -Version 3 | |
function ConvertFrom-GuidToImmutableId ([Guid]$Guid){ | |
[System.Convert]::ToBase64String([Guid]::Parse($Guid).ToByteArray()) | |
} | |
New-Alias -Name g2i -Value ConvertFrom-GuidToImmutableId | |
function ConvertFrom-ImmutableIdToGuid ([string]$ImmutableId) { |
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
<# | |
.Synopsis | |
Generate one or more random passwords, from 7 to 64 characters in length. | |
.Description | |
Passwords are generated using an equal distribution of upper and lower case letters, numbers, space, and special | |
characters found on the number row. | |
.Parameter Length | |
Specifies the length of the generated password(s). |
NewerOlder