Any PowerShell people can help with DSC in Jenkins?

49 views
Skip to first unread message

Mark Allison

unread,
Jan 3, 2017, 6:54:23 AM1/3/17
to Jenkins Users
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?

Mark Allison

unread,
Jan 3, 2017, 10:52:37 AM1/3/17
to Jenkins Users
Running Jenkins as a 64-bit process solved the issue. See http://stackoverflow.com/a/34030153/38211
Reply all
Reply to author
Forward
0 new messages