DSC
DSC copied to clipboard
Doc: WinPS resources need to be installed for AllUsers
Prerequisites
- [x] Write a descriptive title.
- [x] Make sure you are able to repro it on the latest version
- [x] Search the existing issues.
Summary
The fundamental issue is:
- WinPS Adapter only uses PSDSC 1.1 because it comes with Windows
- PSDSC 1.1 always uses LCM which runs as a Windows service
- Windows service only has view of AllUsers under ProgramFiles (this was a design decision for DSC v1)
So this means that any configuration that requires WinPS (explicitly or implicitly) they will hit an error that the resource is not found unless that resource is installed for scope AllUsers. PSDSC v2 fixes this, but is not part of Windows so would be an additional dependency.
At this time, I think we should just doc that WinPS adapter requires resources to be installed for AllUsers
@michaeltlombardi @theJasonHelmick
Steps to reproduce
Install-Module ComputerManagmentDsc -Scope CurrentUser
$yaml = @'
$schema: https://aka.ms/dsc/schemas/v3/bundled/config/document.json
resources:
- name: Install OpenSSH Server
type: ComputerManagementDsc/WindowsCapability
properties:
Ensure: Present
Name: OpenSSH.Server~~~~0.0.1.0
'@
dsc config test -i $yaml
### Expected behavior
```console
success
Actual behavior
error resource not found
Error details
Environment data
Name Value
---- -----
PSVersion 7.6.0-preview.4
PSEdition Core
GitCommitId 7.6.0-preview.4
OS Microsoft Windows 10.0.22631
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Version
3.1.0-preview.3
Visuals
No response
In the winPS adapter class-based resources are called directly and do not use the LCM. So the document should only be limited to Script and Binary resources.
https://github.com/PowerShell/DSC/blob/47c0d4fc61affb61547bdcf4cd250a80aa29f717/powershell-adapter/psDscAdapter/win_psDscAdapter.psm1#L398-L400
https://github.com/PowerShell/DSC/blob/47c0d4fc61affb61547bdcf4cd250a80aa29f717/powershell-adapter/psDscAdapter/win_psDscAdapter.psm1#L425-L442
I think this issue can be solved, as it is documented at: https://github.com/PowerShell/DSC/blob/main/docs/troubleshooting/known-issues.md#resource-not-found-when-using-windows-powershell-adapter