DSC Resource not showing

This topic contains 7 replies, has 3 voices, and was last updated by  Narinder Verma 1 day, 19 hours ago.

  • Author
    Posts
  • #84860

    Narinder Verma
    Participant

    I copied a DSC Resource cChoco to C:\Program Files\WindowsPowerShell\Modules but still when i do get-dscresource it doesn`t show this cChoco module.
    When i copied the resource to C:\Windows\System32\WindowsPowerShell\v1.0\Modules the Get-Dscresource command stopped working it said the command cannot be found.

    Any idea to resolve this without applying any patch or uppdate.
    Currently i am on PS version 4

  • #85088

    Don Jones
    Keymaster

    Definitely don't copy stuff into System32. That's Microsoft's playground not ours :).

    Check the PSModulePath environment variable and ensure your Program Files path is listed. Also ensure that the cChoco module is correctly laid out – it would normally have a DscResources subfolder, it needs the correct .psd1 manifest files, a schema MOF, and so on. All of those things need to be correct for PowerShell to "see" it.

    You haven't provided any information about the environment (versions, etc) or commands you're running, but I'm guessing that (A) the module isn't properly structured and (B) your PSModulePath isn't complete.

  • #85130

    Narinder Verma
    Participant

    I ran install-module cchoco on my source that is on PS version 5.0 and then i copied the cchoco module from my source to my client which is on PS version 4.0 but i can`t see it in get-dscresource

    Do you still think it`s structure issue as the module is working fine on my source

  • #85156

    Don Jones
    Keymaster

    The structure should be fine wither way. Either (a) PSModulePath on your v4 machine doesn't include that path or (b) the module itself isn't v4 compatible.

  • #85234

    Narinder Verma
    Participant

    Here is my PSModulePath on v4 machine
    PS C:\Windows\system32> $env:PSModulePath
    C:\Users\salttest\Documents\WindowsPowerShell\Modules;C:\Program Files\WindowsPowerShell\Modules;C:\Windows\system32\
    WindowsPowerShell\v1.0\Modules\;C:\Program Files (x86)\AWS Tools\PowerShell\

    Once i apply packagemanagement patch n use install-module the resource is working fine so that means that it`s compatible na?

  • #85250

    Don Jones
    Keymaster

    It doesn't mean it's compatible, no. Install-Module doesn't check for compatibility of the code, it just copies the files. The PSModulePath looks correct, though.

  • #85297

    Alex Aymonier
    Participant

    One thing i cam across the other day taking a module from a machine on v5 to v4 was the module having a version number in the path broke the module eg:

    C:\Program Files\WindowsPowerShell\Modules\PowerShellCookbook\1.3.6

    But if i move the module contents up one level to

    C:\Program Files\WindowsPowerShell\Modules\PowerShellCookbook

    It is then picked up.

You must be logged in to reply to this topic.