Skip to content

Instantly share code, notes, and snippets.

@gavincampbell gavincampbell/misc.ps1
Last active Mar 11, 2019

Embed
What would you like to do?
Powershell Aides-Mémoire
#Creating a pscredential from a username:password pair in a single line:
$Creds = New-Object System.Management.Automation.PSCredential ($User, $(ConvertTo-SecureString $Password -AsPlainText -Force))
#Self signed wildcard certificate
New-SelfSignedCertificate -Subject *.my.domain -DnsName my.domain, *.my.domain -CertStoreLocation Cert:\LocalMachine\My -NotAfter (Get-Date).AddYears(10)
# trusting the PS gallery so we can install packages unattended, e.g. for DSC
Install-PackageProvider NuGet -Force -Scope CurrentUser
Import-PackageProvider NuGet -Force
Set-PSRepository -Name PSGallery -InstallationPolicy Trusted
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.