Skip to content

Instantly share code, notes, and snippets.

View duffney's full-sized avatar
⌨️
Coding

Josh Duffney duffney

⌨️
Coding
View GitHub Profile
@duffney
duffney / ConvertTo-DSCPullArchive.ps1
Created December 1, 2015 15:57
Converts DSC resources to an archive .zip file for DSC Pull server use.
function ConvertTo-DSCPullArchive
{
<#
.Synopsis
Converts PowerShell Modules to compressed .zip files.
.DESCRIPTION
Converts PowerShell Modules to compressed .zip files
used by Desired State Configuraiton pull servers.
.PARAMETER Source
Specifies the source location of a PowerShell module.
@duffney
duffney / CreateHyperVNetworkAdapters.ps1
Last active December 4, 2015 14:45
Create Hyper-V Network Adapters
#Get Net Adapter Names
$NetAdapterName = (Get-NetAdapter).Name
#Create the External Hyper-V Switch
New-VMSwitch -NetAdapterName $NetAdapterName[0] -Name 'External'
#Create the Internal Hyper-V Switch
New-VMSwitch -SwitchType Internal -Name 'Internal'
$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
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
Invoke-Command -ComputerName S2 -ScriptBlock {Find-Module xAdcsDeployment,xNetworking,xComputerManagement,xTimeZone | Install-Module -Confirm:$false -Verbose}
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 s3 {Get-Childitem Cert:\LocalMachine\My}
Configuration DSCLabUp {
param (
[string[]]$NodeName,
[string]$MachineName
)
Import-DscResource -ModuleName xActiveDirectory
Import-DscResource –ModuleName xPSDesiredStateConfiguration
Import-DscResource -Module xNetworking
$DNSArray = @('127.0.0.1')
$ConfigData = @{
AllNodes = @(
@{
Nodename = 'Localhost'
Role = "DomainController"
MachineName = 'ZDC01'
DomainName = "Zephyr.org"
Configuration HTTPSPull {
param (
[string[]]$NodeName,
[string]$MachineName,
[string]$IPAddress,
[string]$DefaultGateway,
[string[]]$DNSIPAddress,
[string]$DomaniName
)