Get-DscResource not showing all resources when run from Jenkins

Tagged: 

This topic contains 1 reply, has 1 voice, and was last updated by Profile photo of Mark Allison Mark Allison 2 months, 3 weeks ago.

  • Author
    Posts
  • #61084
    Profile photo of Mark Allison
    Mark Allison
    Participant

    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                       3.6.0.0    {Name, Path, DependsOn, Ensure...}
        PowerShell      xVhdFile                  xHyper-V                       3.6.0.0    {FileDirectory, VhdPath, CheckSu...
        PowerShell      xVMHyperV                 xHyper-V                       3.6.0.0    {Name, VhdPath, DependsOn, Enabl...
        PowerShell      xVMSwitch                 xHyper-V                       3.6.0.0    {Name, Type, AllowManagementOS, ...
    
    

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

  • #61104
    Profile photo of Mark Allison
    Mark Allison
    Participant

    Running Jenkins as 64-bit solved the issue.

    See http://stackoverflow.com/a/34030153/38211

You must be logged in to reply to this topic.