Skip to content

Instantly share code, notes, and snippets.

@ryancbutler
Last active June 15, 2018 21:27
Show Gist options
  • Save ryancbutler/877c9ae605a39a8e7d2bf2a6fd50dac0 to your computer and use it in GitHub Desktop.
Save ryancbutler/877c9ae605a39a8e7d2bf2a6fd50dac0 to your computer and use it in GitHub Desktop.
bootstrap
iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
Enable-Psremoting -force -SkipNetworkProfileCheck
choco install -y git -params '"/GitOnlyOnPath"'
Install-PackageProvider -Name NuGet -Force
find-module -Repository PSGallery -Name PowerShellGet | Install-Module -Force
find-module -Repository PSGallery -Name PSScriptAnalyzer | Install-Module -Force
find-module -Repository PSGallery -Name Pester | Install-Module -Force -SkipPublisherCheck
Find-Module -Name xComputerManagement -Repository PSGallery | Install-Module -Force
Find-Module -Name xRemoteDesktopAdmin -Repository PSGallery | Install-Module -Force
Find-Module -Name xWinRm -Repository PSGallery | Install-Module -Force
$env:Path += ";$env:ProgramFiles\Git\cmd"
configuration mdtnodomain {
Import-DscResource -ModuleName PsDesiredStateConfiguration
Import-DscResource -ModuleName xComputerManagement
Import-DscResource -ModuleName xRemoteDesktopAdmin
Import-DscResource -ModuleName xWinRM
node LOCALHOST {
xRemoteDesktopAdmin RemoteDesktopSettings
{
Ensure = 'Present'
UserAuthentication = 'Secure'
}
xWinRM WinRMHTTPS
{
Protocol = "HTTPS"
Ensure = "Present"
Service_AllowUnencrypted = 'false'
}
Script DisableDomainFirewall
{
GetScript = {
@{
GetScript = $GetScript
SetScript = $SetScript
TestScript = $TestScript
Result = -not('True' -in (Get-NetFirewallProfile -Name "Public").Enabled)
}
}
SetScript = {
Set-NetFirewallProfile -Name "Public" -Enabled False -Verbose
}
TestScript = {
$Status = -not('True' -in (Get-NetFirewallProfile -Name "Public").Enabled)
$Status -eq $True
}
}
Registry "DisableIPV6" #ResourceName
{
Key = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip6\Parameters"
ValueName = "DisabledComponents"
ValueData = "255"
ValueType = "DWORD"
}
}
}
[DSCLocalConfigurationManager()]
configuration LCMConfig
{
Node localhost
{
Settings
{
RebootNodeIfNeeded = $true
}
}
}
mdtnodomain
LCMConfig
Start-Transcript ("${env:SystemRoot}\Temp\DSC.log")
Set-DscLocalConfigurationManager -Path "C:\Windows\Temp\mdtnodomain\LCMConfig" -Verbose -Force
Start-DscConfiguration -Path "C:\Windows\Temp\mdtnodomain\mdtnodomain" -Verbose -Wait -Force
& "C:\Windows\Temp\mdtnodomain\CitrixOptimizer\CtxOptimizerEngine.ps1" -Source "C:\Windows\Temp\mdtnodomain\CitrixOptimizer\Templates\Citrix_Windows10_1803.xml" -Mode Execute -OutputXml "${env:SystemRoot}\Temp\ctxopt.xml"
Set-Item WSMan:\localhost\client\TrustedHosts -Value '*' -confirm:$false -Force
Start-DscConfiguration -Path "C:\Windows\Temp\mdtnodomain\mdtnodomain" -Verbose -Wait -Force
Stop-Transcript
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment