Skip to content

Instantly share code, notes, and snippets.

Avatar

Brandon Stiff BrandonStiff

View GitHub Profile
@BrandonStiff
BrandonStiff / Export-PSCredential.ps1
Last active Apr 19, 2017
Export A PowerShell Credential
View Export-PSCredential.ps1
function Export-PSCredential
{
<#
.SYNOPSIS
Exports a credential object into an XML file or registry value with an encrypted password. An important note is that the encrypted password can ONLY be read by the user who created the exported file
unless a passphrase is provided.
.PARAMETER Credential
Specifies the Credential to export to a file. Use Get-Credential to supply this.
View Get-EncryptionKey.ps1
function Get-EncryptionKey()
{
<#
.SYNOPSIS
Retrieves a 128/192/256-bit encryption key using the given keyphrase.
.PARAMETER KeyPhrase
Specifies the phrase to use to create the 128-bit key.
.PARAMETER Length
@BrandonStiff
BrandonStiff / Invoke-WindowsActivation.ps1
Last active May 1, 2017
Activate a Windows Host by Proxy
View Invoke-WindowsActivation.ps1
function Invoke-WindowsActivation()
{
<#
.SYNOPSIS
This function reaches out remotely to the specified VAMT server and activates the given machines by proxy. To run this, you must meet the following requirements:
* The ActiveDirectory module from Microsoft be installed on the machine this function runs from. Install with:
Add-WindowsFeature
* It's assumed the machines you are dealing with are on an Active Directory domain.