Add DSC configurations for user interface, Windows features, and services; implement app installation and removal scripts
- Created `DSC-UserInterfaceConfiguration.ps1` to manage user interface settings via registry changes. - Developed `DSC-WindowsFeatures.ps1` to install OpenSSH Client and enable NFS Client features. - Implemented `DSC-WindowsServices.ps1` to ensure Terminal Services are running and set to automatic startup. - Added `PS-InstallApps.ps1` to manage app installations and remove the msstore source if it exists. - Created `PS-RemoveApps.ps1` to remove unwanted apps, provisioned packages, and handle Office applications via winget.
This commit is contained in:
89
DSC-EnvironmentVariables.ps1
Normal file
89
DSC-EnvironmentVariables.ps1
Normal file
@@ -0,0 +1,89 @@
|
||||
Configuration EnvironmentVariables {
|
||||
Import-DscResource -ModuleName PSDesiredStateConfiguration
|
||||
|
||||
Node localhost {
|
||||
|
||||
# === MINIFORGE PYTHON ENVIRONMENT (from 2_ConfigUpdate.ps1) ===
|
||||
|
||||
# Add Miniforge3 base directory to PATH
|
||||
Script AddMiniforgePath {
|
||||
SetScript = {
|
||||
$forgePath = "C:\ProgramData\miniforge3"
|
||||
$currentPath = [System.Environment]::GetEnvironmentVariable("Path", "Machine")
|
||||
if (-not ($currentPath -split ";" | Where-Object { $_ -eq $forgePath })) {
|
||||
$newPath = $currentPath + ";" + $forgePath
|
||||
[System.Environment]::SetEnvironmentVariable("Path", $newPath, "Machine")
|
||||
Write-Verbose "Added $forgePath to system PATH"
|
||||
}
|
||||
}
|
||||
TestScript = {
|
||||
$forgePath = "C:\ProgramData\miniforge3"
|
||||
$currentPath = [System.Environment]::GetEnvironmentVariable("Path", "Machine")
|
||||
return ($currentPath -split ";" | Where-Object { $_ -eq $forgePath }).Count -gt 0
|
||||
}
|
||||
GetScript = {
|
||||
$forgePath = "C:\ProgramData\miniforge3"
|
||||
$currentPath = [System.Environment]::GetEnvironmentVariable("Path", "Machine")
|
||||
$exists = ($currentPath -split ";" | Where-Object { $_ -eq $forgePath }).Count -gt 0
|
||||
return @{Result = "Miniforge path exists: $exists"}
|
||||
}
|
||||
}
|
||||
|
||||
# Add Miniforge3 Scripts directory to PATH
|
||||
Script AddMiniforgeScriptsPath {
|
||||
SetScript = {
|
||||
$forgeScriptsPath = "C:\ProgramData\miniforge3\Scripts"
|
||||
$currentPath = [System.Environment]::GetEnvironmentVariable("Path", "Machine")
|
||||
if (-not ($currentPath -split ";" | Where-Object { $_ -eq $forgeScriptsPath })) {
|
||||
$newPath = $currentPath + ";" + $forgeScriptsPath
|
||||
[System.Environment]::SetEnvironmentVariable("Path", $newPath, "Machine")
|
||||
Write-Verbose "Added $forgeScriptsPath to system PATH"
|
||||
}
|
||||
}
|
||||
TestScript = {
|
||||
$forgeScriptsPath = "C:\ProgramData\miniforge3\Scripts"
|
||||
$currentPath = [System.Environment]::GetEnvironmentVariable("Path", "Machine")
|
||||
return ($currentPath -split ";" | Where-Object { $_ -eq $forgeScriptsPath }).Count -gt 0
|
||||
}
|
||||
GetScript = {
|
||||
$forgeScriptsPath = "C:\ProgramData\miniforge3\Scripts"
|
||||
$currentPath = [System.Environment]::GetEnvironmentVariable("Path", "Machine")
|
||||
$exists = ($currentPath -split ";" | Where-Object { $_ -eq $forgeScriptsPath }).Count -gt 0
|
||||
return @{Result = "Miniforge Scripts path exists: $exists"}
|
||||
}
|
||||
DependsOn = "[Script]AddMiniforgePath"
|
||||
}
|
||||
|
||||
# Set Conda/Mamba environment variables
|
||||
Environment SetCondaDefault {
|
||||
Name = "CONDA_DEFAULT_ENV"
|
||||
Value = "base"
|
||||
Ensure = "Present"
|
||||
}
|
||||
Environment SetCondaEnvPrompt {
|
||||
Name = "CONDA_PROMPT_MODIFIER"
|
||||
Value = "(base) "
|
||||
Ensure = "Present"
|
||||
}
|
||||
|
||||
# Python/Conda specific
|
||||
Environment SetPythonPath {
|
||||
Name = "PYTHONPATH"
|
||||
Value = "C:\ProgramData\miniforge3\Lib\site-packages"
|
||||
Ensure = "Present"
|
||||
}
|
||||
|
||||
Environment SetDeveloperMode {
|
||||
Name = "DEVELOPER_MODE"
|
||||
Value = "1"
|
||||
Ensure = "Present"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Generate the MOF file
|
||||
$outputPath = "$env:TEMP\DSC\EnvironmentVariables"
|
||||
EnvironmentVariables -OutputPath $outputPath
|
||||
|
||||
# Apply the configuration
|
||||
Start-DscConfiguration -Path $outputPath -Wait -Verbose -Force
|
||||
Reference in New Issue
Block a user