Closed nbucking closed 3 years ago
We have talked about this in the past, and will consider it for future implementation, but at the moment there are no immediate plans to turn this into a DSC version.
Here's what I'm doing for DSC. Note the Test-Resource is just enough to keep it from running multiple times and shouldn't conflict with my PowerSTIG DSC (there's some overlap of settings). Please @ mention me if you build a more robust Test-Resource:
configuration "WVDHostPooledW10"
{
Import-DscResource -ModuleName ComputerManagementDsc
Import-DscResource -ModuleName FileDownloadDSC
Import-DscResource -ModuleName PSDscResources
Node "localhost"
{
# WVD Optimization Tool - https://github.com/The-Virtual-Desktop-Team/Virtual-Desktop-Optimization-Tool
FileDownload "WVDOptimizer"
{
FileName = "C:\Packages\Virtual-Desktop-Optimization-Tool-main.zip"
Url = "https://github.com/The-Virtual-Desktop-Team/Virtual-Desktop-Optimization-Tool/archive/refs/heads/main.zip"
}
Archive "ExtractWVDOptimizer"
{
Path = "C:\Packages\Virtual-Desktop-Optimization-Tool-main.zip"
Destination = "c:\Packages\"
DependsOn = "[FileDownload]WVDOptimizer"
}
Script "OptimizeWVD" {
SetScript = {
Set-Location -Path "C:\Packages\Virtual-Desktop-Optimization-Tool-main\"
$ExecPolicy = Get-ExecutionPolicy
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned
.\Win10_VirtualDesktop_Optimize.ps1
Set-ExecutionPolicy -ExecutionPolicy $ExecPolicy
$global:DSCMachineStatus = 1 # Require reboot
}
GetScript = {
return @{'Return'=''}
}
TestScript = {
try{
return ( (Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\DWM" -Name "DisallowAnimations" -ErrorAction SilentlyContinue) -eq 1)
} catch {
return $false
}
}
DependsOn = "[Archive]ExtractWVDOptimizer"
}
PendingReboot "RebootAfterOptimize"
{
Name = "RebootAfterOptimize"
}
}
}
@KenBenjamin
This will help with a deployment via our pull server thanks! Although we will have to take out the download portion since we are not able to get out to the internet (air gap to the DSC pull server). I was thinking more along the lines of creating resources that could do the same thing but this is a good short term solution.
Hello @KenBenjamin . We have added this item to our backlog, and will be looking to work on this in the near future. Thank you for your contribution. We will certainly @ mention you if we update code based on your feedback.
Is it possible to create a DSC version of the tool? It seems like deploying via DSC would help with our personal VDI (persistent VDIs) to prevent skew.