I'm writing a winget configuration file (Link) with a lot of actions (Install apps, set env var, set registry, set pc configuration, clone repos, ...). I found no easy way to map a network drive.
I try to set registry keys (Link) and this is working (after pc restart).
# yaml-language-server: $schema=https://aka.ms/configuration-dsc-schema/0.2
properties:
configurationVersion: 0.2.0
resources:
- resource: PSDscResources/Registry
directives:
description: Map network drive H
settings:
Key: 'HKEY_CURRENT_USER\Network\H'
Ensure: Present
ValueName: RemotePath
ValueType: String
ValueData: \\my_network_path
Force: True
- resource: PSDscResources/Registry
directives:
description: Map network drive H
settings:
Key: 'HKEY_CURRENT_USER\Network\H'
Ensure: Present
ValueName: ConnectFlags
ValueType: DWord
ValueData: 0
But isn't there an easier way to map a network drive by a winget configuration file? I have not been able to execute the powershell command New-PsDrive directly in the configuration file (is that even possible?) and have not found a suitable dsc resource package.
Many thanks for your help.
I found one solution to use the DscResource Script:
Is there any better solution?