VMware Cloud Community
TheVMinator
Expert
Expert

Using DSC (Desired State Configuration) with PowerCLI

HAs anyone been successful in using the new DSC with PowerCLI to configure a newly provisioned windows OS in a VM by connecting to the vcenter where the VM is?  would you be willing to share your use case and code?

Reply
0 Kudos
13 Replies
TheVMinator
Expert
Expert

Anyone?

Reply
0 Kudos
LucD
Leadership
Leadership

It's my planning, but I haven't completed my trials yet Smiley Sad


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
TheVMinator
Expert
Expert

Thanks LucD , will look forward to your take on DSC and anyone out there who has used it.

Reply
0 Kudos
ITSnoesberger
Enthusiast
Enthusiast

Hi

I'm trying to use VMWare PowerCLI commandlets in DSC. But I don't get it working.

I always get the following error:

The PowerShell provider sc_vcenter_cluster threw one or more non-terminating errors while running the

Set-TargetResource functionality. These errors are logged to the ETW channel called Microsoft-Windows-DSC/Operational.

Refer to this channel for more details.

    + CategoryInfo          : InvalidOperation: (:) [], CimException

    + FullyQualifiedErrorId : NonTerminatingErrorFromProvider

    + PSComputerName        : localhost

Also when I try with a simple command "get-VM" I don't get any data.

Does anyone had success trying DSC with VMWare.

Reply
0 Kudos
LucD
Leadership
Leadership

Do you have some more info on the setup you are using.

Did you you try to write/use a Script Resource to handle the vSphere  ?

Are you using a push or a pull model ?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
ITSnoesberger
Enthusiast
Enthusiast

Our plan is to manage vCenter/ESX/VM configurations with Powershell DSC.

So I've written an own DSC Module for creating clusters (Test/Set/get-TargetResource)

When I'm creating then a DSC Configuration manually and applying it with:

Start-DscConfiguration <folder> -Wait -Verbose, it's connecting to the vCenter but for every command connecting to the vCenter I don't receive any Data:

Example: $clusters = get-cluster

Did you had the same problem?

Reply
0 Kudos
alanrenouf
VMware Employee
VMware Employee

Are you able to share the resources you have written here?  I would love to see them.

Blog: http://virtu-al.net Twitter: http://twitter.com/alanrenouf Co-author of the PowerCLI Book: http://powerclibook.com
Reply
0 Kudos
BrandonOlin
Contributor
Contributor

This is something I'm planning on looking at as well. I haven't started the DSC modules yet, but I hope to start working on that in the next few weeks. Below I've written about how a DSC configuration might potentially look like to provision a VM.

http://devblackops.io/vmware-provisioning-with-dsc/

-Brandon

@devblackops

davidobrien
Contributor
Contributor

I know this is rather old, but has anybody been able to do this?

I am just about to start working on this and rather not reinvent the wheel. Thought about using a PowerShell workflow to build the VM and as part of that create the DSC MOF file which will be remotely applied to the VM. Only thing that's currently worrying me is the remote access to that VM (also, that VM not yet being ready yet after deployment and customisation).

Cheers

David

Reply
0 Kudos
LucD
Leadership
Leadership

See 22nd VMUGBE+ event


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
BrandonOlin
Contributor
Contributor

Sounds interesting. I'm interested in seeing what you've developed.

Reply
0 Kudos
LucD
Leadership
Leadership

You're probably already miles ahead of me :smileygrin:


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
BrandonOlin
Contributor
Contributor

I have a working example for creating the VM with DSC here:

http://devblackops.io/2015/04/10/vmware-provisioning-with-powershell-dsc/

This will deploy a VM from a template that has a small DSC bootstrap script that will get executed as part of the OS customization. That bootstrap script will configure the LCM in the guest OS to talk to the pull server and grab the DSC configuration for the guest.

Right now, you have to create two DSC configurations. One for the VM definition which is applied to a provisioning server with PowerCLI installed, and one for the guest OS. I'd like to come up with a way define the state of the VM in a single place (VM and OS config) but at the end of the day, two MOF files would still be generated (VM definition and guest OS).

Reply
0 Kudos