As xRemoteFile Resource in the MSFT PSDesiredStateConfiguration Moduel have several bugs.
This Resource fix all of them to download remote file, more stable and faster.
Changed
HttpClient
MSFT module handle by Invoke-WebRequest. It is east to create, but not faster enough and hard to handle flexibility and is low performance of speed.
cDownload using System.Net.Http.HttpClient to handle http handler and connection.
Also file downloaded will write through IO.Stream, not by String.
Added ContentType property
All the property xRemoteFile is inherited in cDownload. But I added ContentType Property for Http handling.
As you know, some site requires specific ContentType.
Added AllowRedirect Property
cDownload supports AllowRedirect property. It allows you control redirect preference.
More Credential management for Basic Authorization
As cDownload using HttpClient, Basic authorization handling is more flexible. Credential will add to the request header with base64 encoding.
KeepAlive handling
cDownload always add KeepAlive as true in the request header.
Improve Cache handling
MSFT using LastWriteTime to compare existing file and cache. (Can't understand why but I can say it's wrong.) cDownload comparing file and cache with SHA256 file hash.
Also you can specify cache location to keep. MSFT using $env:ProgramData\Microsoft\Windows\PowerShell\Configuration\BuiltinProvCache\Grani_Download but it is cleared every time before LCM runs. Not LCM reset time but run time! It means every time you ran Start-DSCConfiguration, cache will erased before start Test -> Set Target Resource. You can see cache always disappeared, deleted by LCM, and cache -> file matching will always fail.
Hey, what the cache means?
cDownload can specify cache location where LCM not affected, default is $env:ProgramData\Microsoft\Windows\PowerShell\Configuration\CustomProvCache\Grani_Download.
Also you can specify to where you want.
More Typed handling.
Added Type information for all items.
More Debug messages.
Easy to track what has been done by -Debug parameter when you ran Start-DSCConfiguration or Pester test.
Re-Organize GraniResource Project Structure
Description
As there are many resources, more Pester Test was added. Previously all files were included into GraniResource Module. However this isn't think as correct.
All items should managed by Visual Studio project (*.psproj) and Will handle by PowerShell Tools for Visual Studio.
Changed
Divide items into 3 to clean up project.
GraniResouce : Module for DSCResource is included.
GraniResource.Test : Pester and several test and configuration result were included.
GraniResource.Designer : xDSCDesigner materials are included.
Grani_Download
Description
As xRemoteFile Resource in the MSFT PSDesiredStateConfiguration Moduel have several bugs.
This Resource fix all of them to download remote file, more stable and faster.
Changed
HttpClient
MSFT module handle by Invoke-WebRequest. It is east to create, but not faster enough and hard to handle flexibility and is low performance of speed.
cDownload using
System.Net.Http.HttpClient
to handle http handler and connection.Also file downloaded will write through
IO.Stream
, not by String.Added ContentType property
All the property xRemoteFile is inherited in cDownload. But I added ContentType Property for Http handling.
As you know, some site requires specific ContentType.
Added AllowRedirect Property
cDownload supports AllowRedirect property. It allows you control redirect preference.
More Credential management for Basic Authorization
As cDownload using HttpClient, Basic authorization handling is more flexible. Credential will add to the request header with base64 encoding.
KeepAlive handling
cDownload always add KeepAlive as
true
in the request header.Improve Cache handling
MSFT using
LastWriteTime
to compare existing file and cache. (Can't understand why but I can say it's wrong.) cDownload comparing file and cache with SHA256 file hash.Also you can specify cache location to keep. MSFT using
$env:ProgramData\Microsoft\Windows\PowerShell\Configuration\BuiltinProvCache\Grani_Download
but it is cleared every time before LCM runs. Not LCM reset time but run time! It means every time you ranStart-DSCConfiguration
, cache will erased before start Test -> Set Target Resource. You can see cache always disappeared, deleted by LCM, and cache -> file matching will always fail.Hey, what the cache means?
cDownload can specify cache location where LCM not affected, default is
$env:ProgramData\Microsoft\Windows\PowerShell\Configuration\CustomProvCache\Grani_Download
.Also you can specify to where you want.
More Typed handling.
Added Type information for all items.
More Debug messages.
Easy to track what has been done by
-Debug
parameter when you ranStart-DSCConfiguration
or Pester test.Re-Organize GraniResource Project Structure
Description
As there are many resources, more Pester Test was added. Previously all files were included into GraniResource Module. However this isn't think as correct.
All items should managed by Visual Studio project (*.psproj) and Will handle by PowerShell Tools for Visual Studio.
Changed
Divide items into 3 to clean up project.