Running Jenkins as a 64-bit process solved the issue. 
See http://stackoverflow.com/a/34030153/38211

On Tuesday, 3 January 2017 11:54:23 UTC, Mark Allison wrote:
>
> 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?
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/31a15873-1a99-4d2b-864f-897ee34aa816%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to