Get-DscResource not showing all resources when run from Jenkins

This topic contains 1 reply, has 1 voice, and was last updated by  Mark Allison 1 year, 4 months ago.

  • Author
  • #61084

    Mark Allison

    I have a Windows Server 2016 Jenkins build box. I want to run some powershell in a Jenkins job.

    As a test I have set the job to do this in a Execute Windows batch command build step:

    powershell -command Get-DscResource -module xhyper-v

    I get this output:

        D:\Jenkins\workspace\build-windows-server-2016-core>powershell -command Get-DscResource -module xhyper-v 
        WARNING: There are no modules present in the system with the given module specification.

    I even tried installing the PowerShell plugin and running it in a Powershell build step and I get the same result.

    If I RDP onto the box and log on as the jenkins service account and open a cmd.exe window and run

    powershell -command Get-DscResource -module xhyper-v

    I get this output:

        C:\Users\svc_jenkins>powershell -command get-dscresource -module xhyper-v
        ImplementedAs   Name                      ModuleName                     Version    Properties
        -------------   ----                      ----------                     -------    ----------
        PowerShell      xVHD                      xHyper-V                 {Name, Path, DependsOn, Ensure...}
        PowerShell      xVhdFile                  xHyper-V                 {FileDirectory, VhdPath, CheckSu...
        PowerShell      xVMHyperV                 xHyper-V                 {Name, VhdPath, DependsOn, Enabl...
        PowerShell      xVMSwitch                 xHyper-V                 {Name, Type, AllowManagementOS, ...

    Any ideas why Get-DscResource can't find xHyper-V module when run from a Jenkins job?

  • #61104

    Mark Allison

    Running Jenkins as 64-bit solved the issue.


You must be logged in to reply to this topic.