Skip to content

Instantly share code, notes, and snippets.

View duffney's full-sized avatar
⌨️
Coding

Josh Duffney duffney

⌨️
Coding
View GitHub Profile
Configuration HTTPSPull {
param (
[string[]]$NodeName,
[string]$MachineName,
[string]$IPAddress,
[string]$DefaultGateway,
[string[]]$DNSIPAddress,
[string]$DomaniName
)
$DNSArray = @('127.0.0.1')
$ConfigData = @{
AllNodes = @(
@{
Nodename = 'Localhost'
Role = "DomainController"
MachineName = 'ZDC01'
DomainName = "Zephyr.org"
Configuration DSCLabUp {
param (
[string[]]$NodeName,
[string]$MachineName
)
Import-DscResource -ModuleName xActiveDirectory
Import-DscResource –ModuleName xPSDesiredStateConfiguration
Import-DscResource -Module xNetworking
Configuration CredentialEncryptExample {
Param (
[Parameter(Mandatory=$true)]
[PSCredential]$Credential
)
Node $AllNodes.NodeName
{
Group TestGroup{
GroupName = 'TestGroup'
@duffney
duffney / Export-MachineCert.ps1
Last active July 15, 2016 11:06
Export-MachineCert
Function Export-MachineCert {
<#
.SYNOPSIS
Harvests a certificate from a remote system.
.DESCRIPTION
Invokes a command on a remote system to copy the certificate to the machine running the command.
.PARAMETER Computername
Specifies the name of the remote system to harvest the certificate.
.PARAMETER Path
Provides the path where the certificate is copied to on the host system.
Invoke-Command -Computername s3 {Get-Childitem Cert:\LocalMachine\My}
Configuration CertificateAuthority
{
Import-DscResource -ModuleName xAdcsDeployment,PSDesiredStateConfiguration,xNetworking,xComputerManagement,xTimeZone
Node $AllNodes.Where{$_.Role -eq "PKI"}.Nodename
{
xTimeZone SystemTimeZone {
TimeZone = 'Central Standard Time'
IsSingleInstance = 'Yes'
Invoke-Command -ComputerName S2 -ScriptBlock {Find-Module xAdcsDeployment,xNetworking,xComputerManagement,xTimeZone | Install-Module -Confirm:$false -Verbose}
Register-PSRepository -Name myNuGetSource -SourceLocation 'https://www.myget.org/F/powershellgetdemo/api/v2' -PublishLocation 'https://www.myget.org/F/powershellgetdemo/api/v2/Packages' -InstallationPolicy Trusted
$Name = 'VyOS'
$SwitchName = 'Internal'
$HardDiskSize = 2GB
$HDPath = 'E:\Hyper-V\Virtual Hard Disks'+'\'+$Name+'.vhdx'
$Generation = '1'
$ISO_Path = 'D:\ISOs\vyos-1.1.6-amd64.iso'
New-VM -Name $Name -SwitchName $SwitchName `
-NewVHDSizeBytes $HardDiskSize `
-NewVHDPath $HDPath -Generation $Generation -MemoryStartupBytes 512MB