Skip to content

Instantly share code, notes, and snippets.

View bobalob's full-sized avatar

Dave Hall bobalob

View GitHub Profile
Configuration TestPull
{
Import-DscResource -ModuleName 'PSDesiredStateConfiguration'
Node dscclient.example.com
{
File tempFolder
{
Ensure = 'Present'
DestinationPath = 'C:\Temp'
Type = 'Directory'
#Creates Terraform App Account
Param (
$ApplicationName="Terraform",
$AppURL="http://terraform.io",
[Parameter(Mandatory=$true)]$AppPassword,
$AppRoleAssigned="Owner"
)
$Account = Login-AzureRmAccount
$Subs = Get-AzureRmSubscription
Configuration OdbcConfig
{
Param(
[Parameter(Mandatory=$true)][ValidateNotNullorEmpty()]$SQLServerName,
[Parameter(Mandatory=$true)][ValidateNotNullorEmpty()]$DatabaseName,
[Parameter(Mandatory=$true)][ValidateNotNullorEmpty()]$ODBCName,
[Parameter(Mandatory=$true)][ValidateNotNullorEmpty()]$ComputerName
)
Import-DscResource -ModuleName 'PSDesiredStateConfiguration'
@bobalob
bobalob / DSC-PartialsLCM-ConfigurationID.PS1
Last active December 13, 2016 20:15
Example to configure the LCM for pulling partial configurations using the ConfigurationID method
[DSCLocalConfigurationManager()]
configuration PullClientConfigNames
{
Node $AllNodes.NodeName
{
Settings
{
RefreshMode = 'Pull'
RefreshFrequencyMins = 30
RebootNodeIfNeeded = $true
@bobalob
bobalob / DSC-PartialsLCM-ConfigurationID-TestConfig.PS1
Last active December 13, 2016 20:19
Example configuration to store on the pullserver for the LCM configured with ConfigurationID
configuration ServerBuild
{
Import-DscResource -ModuleName 'PSDesiredStateConfiguration'
Node $AllNodes.NodeName
{
File ServerBuild
{
DestinationPath = "C:\ServerBuild-1.txt"
Type = "File"
$RemoteHostName = $ENV:ComputerName
$ComputerName = $ENV:ComputerName
Write-Host "Setup WinRM for $RemoteHostName"
$Cert = New-SelfSignedCertificate -DnsName $RemoteHostName, $ComputerName `
-CertStoreLocation "cert:\LocalMachine\My"
$Cert | Out-String
Param(
$UserAccountName="HypervUser",
$UserAccountPassword="P@ssw0rd1"
)
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All -NoRestart
Install-WindowsFeature RSAT-Hyper-V-Tools -IncludeAllSubFeature
NET USER $UserAccountName $UserAccountPassword /ADD
NET LOCALGROUP "Administrators" $UserAccountName /add
Enable-PSRemoting -Force
Param(
$ServerName = "WIN-VCEI81MP4AD",
$UserAccountName="HypervUser",
$UserAccountPassword="P@ssw0rd1"
)
#The next line actually installs ALL hyper-v features including the hypervisor,
# I haven't had time to fix this yet so if this isn't acceptable you should
# remove the line and install the hyper-v client tools manually
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V-Management-Clients -all -NoRestart
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {},
"variables": {},
"resources": [
{
"type": "Microsoft.Storage/storageAccounts",
"name": "randomstorage676",
"apiVersion": "2015-06-15",
@bobalob
bobalob / DeployTemplate.PS1
Created January 17, 2017 19:19
Deploy a template to ARM
New-AzureRmResourceGroup -Name ExampleGroup -Location "North Europe"
New-AzureRmResourceGroupDeployment -Name ExampleGroupDeploy -ResourceGroupName ExampleGroup -TemplateFile BasicStorage.JSON