Jon Warbrick, July 2014, V3.2 (for Ansible 1.7)
First one found from of
# Loosely based on http://www.vistax64.com/powershell/202216-display-image-powershell.html | |
[void][reflection.assembly]::LoadWithPartialName("System.Windows.Forms") | |
$file = (get-item 'C:\Users\Public\Pictures\Sample Pictures\Chrysanthemum.jpg') | |
#$file = (get-item "c:\image.jpg") | |
$img = [System.Drawing.Image]::Fromfile($file); | |
# This tip from http://stackoverflow.com/questions/3358372/windows-forms-look-different-in-powershell-and-powershell-ise-why/3359274#3359274 |
d-i debian-installer/locale string en_US.UTF-8 | |
d-i debian-installer/splash boolean false | |
d-i console-setup/ask_detect boolean false | |
d-i console-setup/layoutcode string us | |
d-i console-setup/variantcode string | |
# network | |
d-i netcfg/get_nameservers string | |
d-i netcfg/get_ipaddress string | |
d-i netcfg/get_netmask string 255.255.255.0 |
function InitializeWindowsCredential | |
{ | |
Write-Verbose ("Loading PasswordVault Class.") | |
[void][Windows.Security.Credentials.PasswordVault,Windows.Security.Credentials,ContentType=WindowsRuntime] | |
} | |
InitializeWindowsCredential | |
function ConvertTo-PasswordCredential | |
{ |
<# | |
.Synopsis | |
Retrieves all available Exceptions to construct ErrorRecord objects. | |
.Description | |
Retrieves all available Exceptions in the current session to construct ErrorRecord objects. | |
.Example | |
$availableExceptions = Get-AvailableExceptionsList | |
# Use the following commands to bind/unbind SSL cert | |
# netsh http add sslcert ipport=0.0.0.0:443 certhash=3badca4f8d38a85269085aba598f0a8a51f057ae "appid={00112233-4455-6677-8899-AABBCCDDEEFF}" | |
# netsh http delete sslcert ipport=0.0.0.0:443 | |
$HttpListener = New-Object System.Net.HttpListener | |
$HttpListener.Prefixes.Add("http://+:80/") | |
$HttpListener.Prefixes.Add("https://+:443/") | |
$HttpListener.Start() | |
While ($HttpListener.IsListening) { | |
$HttpContext = $HttpListener.GetContext() | |
$HttpRequest = $HttpContext.Request |
using System; | |
using System.Threading; | |
static class Program { | |
static void Main() { | |
Console.Write("Performing some task... "); | |
using (var progress = new ProgressBar()) { | |
for (int i = 0; i <= 100; i++) { | |
progress.Report((double) i / 100); |
Jon Warbrick, July 2014, V3.2 (for Ansible 1.7)
First one found from of
Import-Module -Name Lability | |
$hotfixes = @( | |
#region Normal Patches | |
@{ | |
Id = 'windows8.1-kb2939087-x64_76a6b26de1edc9114c11e3da7394dfbcabe4afd8.cab' | |
Uri = 'http://download.windowsupdate.com/d/msdownload/update/software/crup/2014/03/windows8.1-kb2939087-x64_76a6b26de1edc9114c11e3da7394dfbcabe4afd8.cab' | |
}, | |
@{ | |
Id = 'windows8.1-kb2954879-v2-x64_7e2146477888153e6308977bfc2bc14fea2f56b9.cab' |
# The initial version | |
if [ ! -f .env ] | |
then | |
export $(cat .env | xargs) | |
fi | |
# My favorite from the comments. Thanks @richarddewit & others! | |
set -a && source .env && set +a |
class DependsOn : System.Attribute { | |
[string[]]$Name | |
DependsOn([string[]]$name) { | |
$this.Name = $name | |
} | |
} | |
function Invoke-Step { |