-
Notifications
You must be signed in to change notification settings - Fork 53
Resource name 'Archive' is already being used by another Resource or Configuration. #184
Comments
Hi @NemoDima - sorry about the delay in getting back to you. This is because you're importing both PSDesiredStateConfiguration and PSDscResources into the same configuration. PSDscResources is a complete replacement for PSDesiredStateConfiguration. Just import the newer PSDscResources and remove the |
Is there any way to suppress, then, the following Warning? WARNING: The configuration 'xxx' is loading one or more built-in resources without explicitly importing associated modules. Add Import-DscResource -ModuleName 'PSDesiredStateConfiguration' to your configuration to avoid this message. |
Can you share your configuration @richardgavel ? |
No - it is NOT a replacement. The PSDscResources is supposed to overwrite resources in the built-in PSDesiredStateConfiguration (according to https://github.com/PowerShell/PSDscResources) - but it does not export any commands or cmdlets. So whenever you use Start-DscConfiguration or Publish-DscConfiguration, the PSDesiredStateConfiguration module loads. |
I was able to reproduce the problem by creating a configuration with a File resource. You can see the it by opening the following file with PowerShell ISE and clicking the Run Script button in the toolbar. PowerShell will say:
Then, uncomment the first import (PSDesiredStateConfiguration) and press Run Script again. Now, it will run successfully but PowerShell will show a different message.
|
I've attached the file inside a ZIP file. When I tried to share the PS1 file, GitHub said "We don't support that file type. Try again with a GIF, JPEG, JPG, MOV, MP4, PNG, SVG, WEBM, CSV, DOCX, FODG, FODP, FODS, FODT, GZ, LOG, MD, ODF, ODG, ODP, ODS, ODT, PATCH, PDF, PPTX, TGZ, TXT, XLS, XLSX, or ZIP." |
This is the code in the zip file above. Configuration NotepadDemo
{
param ()
Import-DscResource –ModuleName 'PSDesiredStateConfiguration'
Import-DscResource -ModuleName 'PSDscResources'
Node localhost
{
File Notepad {
DestinationPath ="C:\Windows\notepad.exe"
Ensure ="Present"
}
}
}
NotepadDemo |
You have to remove the import of PSDesiredStateConfiguration in this case, and just ignore the warning message that is outputted. This is because the |
Resource name 'Archive' is already being used by another Resource or Configuration.
As I understand, problem same as #88
Details of the scenario you tried and the problem that is occurring
Try to run generate MOF-files
Verbose logs showing the problem
Suggested solution to the issue
N/A
The DSC configuration that is used to reproduce the issue (as detailed as possible)
The operating system the target node is running
Version and build of PowerShell the target node is running
Version of the DSC module that was used ('dev' if using current dev branch)
current
The text was updated successfully, but these errors were encountered: