Skip to content

Instantly share code, notes, and snippets.

@kewalaka
Created February 25, 2018 00:51
Show Gist options
  • Save kewalaka/bb6b5d40a212ad86b632410d21b4d385 to your computer and use it in GitHub Desktop.
Save kewalaka/bb6b5d40a212ad86b632410d21b4d385 to your computer and use it in GitHub Desktop.
Install .Net 3.5 using DSC & Azure Blob
configuration DotNet3
{
Import-DscResource -ModuleName xPSDesiredStateConfiguration
node localhost
{
$dotNetSXSfolder = "C:\Installs\dotNetsxs"
File dotNetSXSFolder
{
Type = "directory"
DestinationPath = $dotNetSXSfolder
Ensure = "Present"
}
xRemoteFile DotNet351SXS
{
Uri = "https://xxxxxxxxxx.blob.core.windows.net/dotnet/2016/microsoft-windows-netfx3-ondemand-package.cab"
DestinationPath = "$dotNetSXSfolder"
DependsOn = "[File]dotNetSXSFolder"
MatchSource = $false
}
WindowsFeature FriendlyName
{
Ensure = "Present"
Name = "NET-Framework-Core"
Source = $dotNetSXSfolder
}
}
}
# Creates a mof and applies the resource
$DscDir = "C:\DSC\"
New-Item $DscDir -ItemType Directory -ErrorAction SilentlyContinue | Out-Null
DotNet3 -OutputPath $DscDir
Start-DscConfiguration -Path $DscDir -Wait -Force -Verbose
@kewalaka
Copy link
Author

For those scenarios where you don't want to rely on a full copy of the Windows media.

This relies on copying the above .cab from the Windows media and making the blob publicly available.

Typically use a file share resource, blob was an experiment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment