Skip to content

Instantly share code, notes, and snippets.

View bobalob's full-sized avatar

Dave Hall bobalob

View GitHub Profile
ip_configuration {
name = "${var.vm_name_prefix}-${count.index}-ipConfig"
subnet_id = "${azurerm_subnet.subnet1.id}"
private_ip_address_allocation = "dynamic"
load_balancer_backend_address_pools_ids = ["${azurerm_lb_backend_address_pool.backend_pool.id}"]
load_balancer_inbound_nat_rules_ids = ["${element(azurerm_lb_nat_rule.winrm_nat.*.id, count.index)}"]
}
Param(
[Parameter(Mandatory=$true)]$Domain,
[Parameter(Mandatory=$true)]$User,
[Parameter(Mandatory=$true)]$computerName
)
$WindowsAccount = Get-WmiObject -Class Win32_Account -Filter "Domain='$($domain)' and Name='$($user)'"
if ($WindowsAccount) {
#### Add user/group into the local group
configuration NewDomain
{
param
(
[Parameter(Mandatory)]
[pscredential]$safemodeAdministratorCred,
[Parameter(Mandatory)]
[pscredential]$domainCred
)
Configuration TestConfig
{
Param(
$FolderName
)
Import-DscResource -ModuleName 'PSDesiredStateConfiguration'
Node localhost
{
File tempFolder
{
Configuration TestPush
{
Import-DscResource -ModuleName 'PSDesiredStateConfiguration'
Node dscclient.example.com
{
File tempFolder
{
Ensure = 'Present'
DestinationPath = 'C:\Temp'
Type = 'Directory'
Param(
[Parameter(Mandatory=$true)][ValidateNotNullorEmpty()]$ComputerName,
$publicKeysLocation = "C:\DSC\publicKeys\",
$configDataLocation = "C:\DSC\ConfigData\"
)
$DSCCert = Invoke-Command -ComputerName $ComputerName -ScriptBlock {
dir cert:\LocalMachine\My | ? { $_.EnhancedKeyUsageList -match "Document Encryption"}
}
Configuration InstallApp
{
Param(
[Parameter(Mandatory=$true)][ValidateNotNullorEmpty()][PsCredential]$credential
)
Import-DscResource -ModuleName 'PSDesiredStateConfiguration'
Node $AllNodes.NodeName
{
LocalConfigurationManager
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force
Install-Module xPSDesiredStateConfiguration -Force
configuration CreatePullServer
{
param
(
[Parameter(Mandatory=$true)][string[]]$ComputerName,
[Parameter(Mandatory=$true)][string]$CertThumbprint
)
[DSCLocalConfigurationManager()]
Configuration LCM_HTTPSPULL
{
param
(
[Parameter(Mandatory=$true)]
[string[]]$ComputerName,
[Parameter(Mandatory=$true)]
[string]$guid
if (!($guid)) {[Guid]$Guid = Read-Host "Paste GUID for client here:"}
$NewPullClientMof = "C:\DSC\NewPullClient\pullclient.example.com.mof"
$GuidPullClientMof = "C:\Program Files\WindowsPowerShell\DscService\Configuration\$($guid.guid).mof"
Copy-Item -Path $NewPullClientMof -Destination $GuidPullClientMof
New-DSCChecksum $NewPullClientMof