0

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?

Matthew Wetmore
  • 1,633
  • 12
  • 21
Mark Allison
  • 2,188
  • 7
  • 26
  • 45

1 Answers1

0

Running Jenkins as 64-bit solved the issue.

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

Thanks to help from ck on sqlcommunity.slack.com

Mark Allison
  • 2,188
  • 7
  • 26
  • 45