# RE: Knife-vSphere plugin (windows)

**URL:** <https://discourse.chef.io/t/re-knife-vsphere-plugin-windows/3146>\
**Category:** Chef Infra (archive)\
**Created:** [September 5, 2012, 6:30pm UTC](https://discourse.chef.io/t/re-knife-vsphere-plugin-windows/3146 "2012-09-05T18:30:58Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Van\_Fossan\_Randy](https://avatars.discourse-cdn.com/v4/letter/v/8797f3/32.png) [@Van\_Fossan\_Randy](https://discourse.chef.io/u/Van_Fossan_Randy)\
**Post date:** [September 5, 2012, 6:30pm UTC](https://discourse.chef.io/t/re-knife-vsphere-plugin-windows/3146/1 "2012-09-05T18:30:58Z")

</div>

Well, I spoke too soon. I thought I tried the --vshost correctly but, I still had the entry in my knife.rb file for the vsphere\_host. Looking at the source for knife-vsphere; specifically, the BaseVsphereCommand.rb file, it shows the --vshost but it doesn’t look like it is coded correctly.?.?.?

If you look at the vsphere\_dc section versus the vsphere\_host section, it looks like a variable is missing.?.?.?

option :vsphere\_dc,  
:short =\> “-d DATACENTER”,  
:long =\> “–vsdc DATACENTER”,  
:description =\> “The Datacenter for vsphere”

option :vsphere\_host,  
:long =\> “–vshost”,  
:description =\> “The vsphere host”

Anyone concur?

Randy

-----Original Message-----  
From: Van Fossan,Randy  
Sent: Wednesday, September 05, 2012 2:12 PM  
To: 'chef@lists.opscode.com’  
Subject: RE: Knife-vSphere plugin (windows)

After looking at the source, I see you can specify the Datacenter and vSphere host. I tried it “-d” and --vshost options and they do work.

-----Original Message-----  
From: Van Fossan,Randy  
Sent: Wednesday, September 05, 2012 1:59 PM  
To: 'chef@lists.opscode.com’  
Subject: Knife-vSphere plugin (windows)

All,

I am having some success with the knife-vsphere (0.2.3) plugin in windows. We have the Chef 0.10.12 Omnibus package for Windows installed and we then installed the knife-vsphere plugin. The plugin seems to work ok in windows after I did a little gem cleanup… My question is, is there a way to pass the vsphere\_dc and vspere\_host via the command line? I have tried setting windows environment variables as follows and it isn’t working.

vsphere\_host="mvcenter.fqdn"  
vshrere\_dc=“mydatacenter”

We have many Data Centers on multiple Virtual Center servers.

We need to run knife-vsphere on a windows chef management console due to using VMware Orchestrator and PowerCLI as a wrapper around the “knife vsphere” command.

Any suggestions?

Thanks  
Randy

---

<div class="post-metadata">

**Author:** ![Jesse\_Campbell](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/jesse_campbell/32/251_2.png) [@Jesse\_Campbell](https://discourse.chef.io/u/Jesse_Campbell)\
**Post date:** [September 8, 2012, 2:54pm UTC](https://discourse.chef.io/t/re-knife-vsphere-plugin-windows/3146/2 "2012-09-08T14:54:43Z")

</div>

What have you had work vs. not work?  
I'm pretty sure I tested both of those options back when I coded them,  
but it was many months ago, and I currently only test on mac os...  
but documentation around the "option" specifications is sparse or  
nonexistent, so some pieces may have been missed.

however, what variable is missing in what you posted? the first option  
sets config[:vsphere\_dc], the second option sets config[:vsphere\_host]

-jesse

On Wed, Sep 5, 2012 at 2:30 PM, Van Fossan,Randy [vanfossr@oclc.org](mailto:vanfossr@oclc.org) wrote:

> Well, I spoke too soon. I thought I tried the --vshost correctly but, I still had the entry in my knife.rb file for the vsphere\_host. Looking at the source for knife-vsphere; specifically, the BaseVsphereCommand.rb file, it shows the --vshost but it doesn't look like it is coded correctly.?.?.?
> 
> If you look at the vsphere\_dc section versus the vsphere\_host section, it looks like a variable is missing.?.?.?
> 
> option :vsphere\_dc,  
> :short =\> "-d DATACENTER",  
> :long =\> "--vsdc DATACENTER",  
> :description =\> "The Datacenter for vsphere"
> 
> option :vsphere\_host,  
> :long =\> "--vshost",  
> :description =\> "The vsphere host"
> 
> Anyone concur?
> 
> Randy
> 
> -----Original Message-----  
> From: Van Fossan,Randy  
> Sent: Wednesday, September 05, 2012 2:12 PM  
> To: 'chef@lists.opscode.com'  
> Subject: RE: Knife-vSphere plugin (windows)
> 
> After looking at the source, I see you can specify the Datacenter and vSphere host. I tried it "-d" and --vshost options and they do work.
> 
> -----Original Message-----  
> From: Van Fossan,Randy  
> Sent: Wednesday, September 05, 2012 1:59 PM  
> To: 'chef@lists.opscode.com'  
> Subject: Knife-vSphere plugin (windows)
> 
> All,
> 
> I am having some success with the knife-vsphere (0.2.3) plugin in windows. We have the Chef 0.10.12 Omnibus package for Windows installed and we then installed the knife-vsphere plugin. The plugin seems to work ok in windows after I did a little gem cleanup.. My question is, is there a way to pass the vsphere\_dc and vspere\_host via the command line? I have tried setting windows environment variables as follows and it isn't working.
> 
> vsphere\_host="mvcenter.fqdn"  
> vshrere\_dc="mydatacenter"
> 
> We have many Data Centers on multiple Virtual Center servers.
> 
> We need to run knife-vsphere on a windows chef management console due to using VMware Orchestrator and PowerCLI as a wrapper around the "knife vsphere" command.
> 
> Any suggestions?
> 
> Thanks  
> Randy

---

<div class="post-metadata">

**Author:** ![Van\_Fossan\_Randy](https://avatars.discourse-cdn.com/v4/letter/v/8797f3/32.png) [@Van\_Fossan\_Randy](https://discourse.chef.io/u/Van_Fossan_Randy)\
**Post date:** [September 10, 2012, 3:28pm UTC](https://discourse.chef.io/t/re-knife-vsphere-plugin-windows/3146/3 "2012-09-10T15:28:48Z")

</div>

Hi Jesse,

The following does not work, I get the error "can't convert true into  
String"

# knife vsphere -u myaccount -p mypassword --vshost myhost.fqdn -d

"mydatacenter" --vsinsecure vm list

# ERROR: TypeError: can't convert true into String

If I change my knife.rb to include "knife[:vsphere\_host] =  
"myhost.fqdn" " and then run the following, it works.

# knife vsphere -u myaccount -p mypassword -d "mydatacenter"

--vsinsecure vm list

I need to be able to specify the --vshost as we have many Virtual Center  
Servers.

I looked at the code here:  
[https://github.com/ezrapagel/knife-vsphere/blob/master/lib/chef/knife/Ba](https://github.com/ezrapagel/knife-vsphere/blob/master/lib/chef/knife/Ba)  
seVsphereCommand.rb

Randy

-----Original Message-----  
From: Jesse Campbell [[mailto:hikeit@gmail.com](mailto:hikeit@gmail.com)]  
Sent: Saturday, September 08, 2012 10:55 AM  
To: [chef@lists.opscode.com](mailto:chef@lists.opscode.com)  
Subject: [chef] Re: RE: Knife-vSphere plugin (windows)

What have you had work vs. not work?  
I'm pretty sure I tested both of those options back when I coded them,  
but it was many months ago, and I currently only test on mac os...  
but documentation around the "option" specifications is sparse or  
nonexistent, so some pieces may have been missed.

however, what variable is missing in what you posted? the first option  
sets config[:vsphere\_dc], the second option sets config[:vsphere\_host]

-jesse

On Wed, Sep 5, 2012 at 2:30 PM, Van Fossan,Randy [vanfossr@oclc.org](mailto:vanfossr@oclc.org)  
wrote:

> Well, I spoke too soon. I thought I tried the --vshost correctly  
> but, I still had the entry in my knife.rb file for the vsphere\_host.  
> Looking at the source for knife-vsphere; specifically, the  
> BaseVsphereCommand.rb file, it shows the --vshost but it doesn't look  
> like it is coded correctly.?.?.?
> 
> If you look at the vsphere\_dc section versus the vsphere\_host section,  
> it looks like a variable is missing.?.?.?
> 
> option :vsphere\_dc,  
> :short =\> "-d DATACENTER",  
> :long =\> "--vsdc DATACENTER",  
> :description =\> "The Datacenter for vsphere"
> 
> option :vsphere\_host,  
> :long =\> "--vshost",  
> :description =\> "The vsphere host"
> 
> Anyone concur?
> 
> Randy
> 
> -----Original Message-----  
> From: Van Fossan,Randy  
> Sent: Wednesday, September 05, 2012 2:12 PM  
> To: 'chef@lists.opscode.com'  
> Subject: RE: Knife-vSphere plugin (windows)
> 
> After looking at the source, I see you can specify the Datacenter and  
> vSphere host. I tried it "-d" and --vshost options and they do work.
> 
> -----Original Message-----  
> From: Van Fossan,Randy  
> Sent: Wednesday, September 05, 2012 1:59 PM  
> To: 'chef@lists.opscode.com'  
> Subject: Knife-vSphere plugin (windows)
> 
> All,
> 
> I am having some success with the knife-vsphere (0.2.3) plugin in  
> windows. We have the Chef 0.10.12 Omnibus package for Windows installed  
> and we then installed the knife-vsphere plugin. The plugin seems to  
> work ok in windows after I did a little gem cleanup.. My question is,  
> is there a way to pass the vsphere\_dc and vspere\_host via the command  
> line? I have tried setting windows environment variables as follows  
> and it isn't working.
> 
> vsphere\_host="mvcenter.fqdn"  
> vshrere\_dc="mydatacenter"
> 
> We have many Data Centers on multiple Virtual Center servers.
> 
> We need to run knife-vsphere on a windows chef management console due  
> to using VMware Orchestrator and PowerCLI as a wrapper around the "knife  
> vsphere" command.
> 
> Any suggestions?
> 
> Thanks  
> Randy

---

<div class="post-metadata">

**Author:** ![Jesse\_Campbell](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/jesse_campbell/32/251_2.png) [@Jesse\_Campbell](https://discourse.chef.io/u/Jesse_Campbell)\
**Post date:** [September 10, 2012, 3:34pm UTC](https://discourse.chef.io/t/re-knife-vsphere-plugin-windows/3146/4 "2012-09-10T15:34:15Z")

</div>

looks like a bug in BaseVsphereCommand.rb  
I have changed the relevant section to this:

```
    option :vsphere_host,
      :long => "--vshost HOST",
      :description => "The vsphere host"

```

You can update your own for now until a new rubygem is created.

What other changes did you need to make to run on windows?

-Jesse

On Mon, Sep 10, 2012 at 11:28 AM, Van Fossan,Randy [vanfossr@oclc.org](mailto:vanfossr@oclc.org) wrote:

> Hi Jesse,
> 
> The following does not work, I get the error "can't convert true into  
> String"
> 
> # knife vsphere -u myaccount -p mypassword --vshost myhost.fqdn -d
> 
> "mydatacenter" --vsinsecure vm list
> 
> # ERROR: TypeError: can't convert true into String
> 
> If I change my knife.rb to include "knife[:vsphere\_host] =  
> "myhost.fqdn" " and then run the following, it works.
> 
> # knife vsphere -u myaccount -p mypassword -d "mydatacenter"
> 
> --vsinsecure vm list
> 
> I need to be able to specify the --vshost as we have many Virtual Center  
> Servers.
> 
> I looked at the code here:  
> [https://github.com/ezrapagel/knife-vsphere/blob/master/lib/chef/knife/Ba](https://github.com/ezrapagel/knife-vsphere/blob/master/lib/chef/knife/Ba)  
> seVsphereCommand.rb
> 
> Randy
> 
> -----Original Message-----  
> From: Jesse Campbell [[mailto:hikeit@gmail.com](mailto:hikeit@gmail.com)]  
> Sent: Saturday, September 08, 2012 10:55 AM  
> To: [chef@lists.opscode.com](mailto:chef@lists.opscode.com)  
> Subject: [chef] Re: RE: Knife-vSphere plugin (windows)
> 
> What have you had work vs. not work?  
> I'm pretty sure I tested both of those options back when I coded them,  
> but it was many months ago, and I currently only test on mac os...  
> but documentation around the "option" specifications is sparse or  
> nonexistent, so some pieces may have been missed.
> 
> however, what variable is missing in what you posted? the first option  
> sets config[:vsphere\_dc], the second option sets config[:vsphere\_host]
> 
> -jesse
> 
> On Wed, Sep 5, 2012 at 2:30 PM, Van Fossan,Randy [vanfossr@oclc.org](mailto:vanfossr@oclc.org)  
> wrote:
> 
> > Well, I spoke too soon. I thought I tried the --vshost correctly  
> > but, I still had the entry in my knife.rb file for the vsphere\_host.  
> > Looking at the source for knife-vsphere; specifically, the  
> > BaseVsphereCommand.rb file, it shows the --vshost but it doesn't look  
> > like it is coded correctly.?.?.?
> > 
> > If you look at the vsphere\_dc section versus the vsphere\_host section,  
> > it looks like a variable is missing.?.?.?
> > 
> > option :vsphere\_dc,  
> > :short =\> "-d DATACENTER",  
> > :long =\> "--vsdc DATACENTER",  
> > :description =\> "The Datacenter for vsphere"
> > 
> > option :vsphere\_host,  
> > :long =\> "--vshost",  
> > :description =\> "The vsphere host"
> > 
> > Anyone concur?
> > 
> > Randy
> > 
> > -----Original Message-----  
> > From: Van Fossan,Randy  
> > Sent: Wednesday, September 05, 2012 2:12 PM  
> > To: 'chef@lists.opscode.com'  
> > Subject: RE: Knife-vSphere plugin (windows)
> > 
> > After looking at the source, I see you can specify the Datacenter and  
> > vSphere host. I tried it "-d" and --vshost options and they do work.
> > 
> > -----Original Message-----  
> > From: Van Fossan,Randy  
> > Sent: Wednesday, September 05, 2012 1:59 PM  
> > To: 'chef@lists.opscode.com'  
> > Subject: Knife-vSphere plugin (windows)
> > 
> > All,
> > 
> > I am having some success with the knife-vsphere (0.2.3) plugin in  
> > windows. We have the Chef 0.10.12 Omnibus package for Windows installed  
> > and we then installed the knife-vsphere plugin. The plugin seems to  
> > work ok in windows after I did a little gem cleanup.. My question is,  
> > is there a way to pass the vsphere\_dc and vspere\_host via the command  
> > line? I have tried setting windows environment variables as follows  
> > and it isn't working.
> > 
> > vsphere\_host="mvcenter.fqdn"  
> > vshrere\_dc="mydatacenter"
> > 
> > We have many Data Centers on multiple Virtual Center servers.
> > 
> > We need to run knife-vsphere on a windows chef management console due  
> > to using VMware Orchestrator and PowerCLI as a wrapper around the "knife  
> > vsphere" command.
> > 
> > Any suggestions?
> > 
> > Thanks  
> > Randy

---

<div class="post-metadata">

**Author:** ![Van\_Fossan\_Randy](https://avatars.discourse-cdn.com/v4/letter/v/8797f3/32.png) [@Van\_Fossan\_Randy](https://discourse.chef.io/u/Van_Fossan_Randy)\
**Post date:** [September 10, 2012, 3:55pm UTC](https://discourse.chef.io/t/re-knife-vsphere-plugin-windows/3146/5 "2012-09-10T15:55:37Z")

</div>

Thanks Jesse, that worked..

Randy

-----Original Message-----  
From: Jesse Campbell [[mailto:hikeit@gmail.com](mailto:hikeit@gmail.com)]  
Sent: Monday, September 10, 2012 11:34 AM  
To: [chef@lists.opscode.com](mailto:chef@lists.opscode.com)  
Subject: [chef] Re: RE: Re: RE: Knife-vSphere plugin (windows)

looks like a bug in BaseVsphereCommand.rb I have changed the relevant  
section to this:

```
    option :vsphere_host,
      :long => "--vshost HOST",
      :description => "The vsphere host"

```

You can update your own for now until a new rubygem is created.

What other changes did you need to make to run on windows?

-Jesse

On Mon, Sep 10, 2012 at 11:28 AM, Van Fossan,Randy [vanfossr@oclc.org](mailto:vanfossr@oclc.org)  
wrote:

> Hi Jesse,
> 
> The following does not work, I get the error "can't convert true into  
> String"
> 
> # knife vsphere -u myaccount -p mypassword --vshost myhost.fqdn -d
> 
> "mydatacenter" --vsinsecure vm list # ERROR: TypeError: can't convert  
> true into String
> 
> If I change my knife.rb to include "knife[:vsphere\_host] =  
> "myhost.fqdn" " and then run the following, it works.
> 
> # knife vsphere -u myaccount -p mypassword -d "mydatacenter"
> 
> --vsinsecure vm list
> 
> I need to be able to specify the --vshost as we have many Virtual  
> Center Servers.
> 
> I looked at the code here:  
> [https://github.com/ezrapagel/knife-vsphere/blob/master/lib/chef/knife/](https://github.com/ezrapagel/knife-vsphere/blob/master/lib/chef/knife/)  
> Ba  
> seVsphereCommand.rb
> 
> Randy
> 
> -----Original Message-----  
> From: Jesse Campbell [[mailto:hikeit@gmail.com](mailto:hikeit@gmail.com)]  
> Sent: Saturday, September 08, 2012 10:55 AM  
> To: [chef@lists.opscode.com](mailto:chef@lists.opscode.com)  
> Subject: [chef] Re: RE: Knife-vSphere plugin (windows)
> 
> What have you had work vs. not work?  
> I'm pretty sure I tested both of those options back when I coded them,

> but it was many months ago, and I currently only test on mac os...  
> but documentation around the "option" specifications is sparse or  
> nonexistent, so some pieces may have been missed.
> 
> however, what variable is missing in what you posted? the first option

> sets config[:vsphere\_dc], the second option sets config[:vsphere\_host]
> 
> -jesse
> 
> On Wed, Sep 5, 2012 at 2:30 PM, Van Fossan,Randy [vanfossr@oclc.org](mailto:vanfossr@oclc.org)  
> wrote:
> 
> > Well, I spoke too soon. I thought I tried the --vshost correctly  
> > but, I still had the entry in my knife.rb file for the vsphere\_host.  
> > Looking at the source for knife-vsphere; specifically, the  
> > BaseVsphereCommand.rb file, it shows the --vshost but it doesn't look  
> > like it is coded correctly.?.?.?
> > 
> > If you look at the vsphere\_dc section versus the vsphere\_host  
> > section,  
> > it looks like a variable is missing.?.?.?
> > 
> > option :vsphere\_dc,  
> > :short =\> "-d DATACENTER",  
> > :long =\> "--vsdc DATACENTER",  
> > :description =\> "The Datacenter for vsphere"
> > 
> > option :vsphere\_host,  
> > :long =\> "--vshost",  
> > :description =\> "The vsphere host"
> > 
> > Anyone concur?
> > 
> > Randy
> > 
> > -----Original Message-----  
> > From: Van Fossan,Randy  
> > Sent: Wednesday, September 05, 2012 2:12 PM  
> > To: 'chef@lists.opscode.com'  
> > Subject: RE: Knife-vSphere plugin (windows)
> > 
> > After looking at the source, I see you can specify the Datacenter and  
> > vSphere host. I tried it "-d" and --vshost options and they do work.
> > 
> > -----Original Message-----  
> > From: Van Fossan,Randy  
> > Sent: Wednesday, September 05, 2012 1:59 PM  
> > To: 'chef@lists.opscode.com'  
> > Subject: Knife-vSphere plugin (windows)
> > 
> > All,
> > 
> > I am having some success with the knife-vsphere (0.2.3) plugin in  
> > windows. We have the Chef 0.10.12 Omnibus package for Windows  
> > installed  
> > and we then installed the knife-vsphere plugin. The plugin seems  
> > to  
> > work ok in windows after I did a little gem cleanup.. My question  
> > is,  
> > is there a way to pass the vsphere\_dc and vspere\_host via the command  
> > line? I have tried setting windows environment variables as follows  
> > and it isn't working.
> > 
> > vsphere\_host="mvcenter.fqdn"  
> > vshrere\_dc="mydatacenter"
> > 
> > We have many Data Centers on multiple Virtual Center servers.
> > 
> > We need to run knife-vsphere on a windows chef management console due  
> > to using VMware Orchestrator and PowerCLI as a wrapper around the  
> > "knife vsphere" command.
> > 
> > Any suggestions?
> > 
> > Thanks  
> > Randy

---

<div class="post-metadata">

**Author:** ![Jesse\_Campbell](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/jesse_campbell/32/251_2.png) [@Jesse\_Campbell](https://discourse.chef.io/u/Jesse_Campbell)\
**Post date:** [September 10, 2012, 4:01pm UTC](https://discourse.chef.io/t/re-knife-vsphere-plugin-windows/3146/6 "2012-09-10T16:01:32Z")

</div>

the documentation for mixlib::CLI is terrible, and I'm not even sure  
why not specifying something after ":long --vshost" switches from a  
boolean to a string, given that there is a :boolean element in the  
option hash...  
still digging...

-jesse

On Mon, Sep 10, 2012 at 11:55 AM, Van Fossan,Randy [vanfossr@oclc.org](mailto:vanfossr@oclc.org) wrote:

> Thanks Jesse, that worked..
> 
> Randy
> 
> -----Original Message-----  
> From: Jesse Campbell [[mailto:hikeit@gmail.com](mailto:hikeit@gmail.com)]  
> Sent: Monday, September 10, 2012 11:34 AM  
> To: [chef@lists.opscode.com](mailto:chef@lists.opscode.com)  
> Subject: [chef] Re: RE: Re: RE: Knife-vSphere plugin (windows)
> 
> looks like a bug in BaseVsphereCommand.rb I have changed the relevant  
> section to this:
> 
> ```
> option :vsphere_host,
> :long => "--vshost HOST",
> :description => "The vsphere host"
> 
> ```
> 
> You can update your own for now until a new rubygem is created.
> 
> What other changes did you need to make to run on windows?
> 
> -Jesse
> 
> On Mon, Sep 10, 2012 at 11:28 AM, Van Fossan,Randy [vanfossr@oclc.org](mailto:vanfossr@oclc.org)  
> wrote:
> 
> > Hi Jesse,
> > 
> > The following does not work, I get the error "can't convert true into  
> > String"
> > 
> > # knife vsphere -u myaccount -p mypassword --vshost myhost.fqdn -d
> > 
> > "mydatacenter" --vsinsecure vm list # ERROR: TypeError: can't convert  
> > true into String
> > 
> > If I change my knife.rb to include "knife[:vsphere\_host] =  
> > "myhost.fqdn" " and then run the following, it works.
> > 
> > # knife vsphere -u myaccount -p mypassword -d "mydatacenter"
> > 
> > --vsinsecure vm list
> > 
> > I need to be able to specify the --vshost as we have many Virtual  
> > Center Servers.
> > 
> > I looked at the code here:  
> > [https://github.com/ezrapagel/knife-vsphere/blob/master/lib/chef/knife/](https://github.com/ezrapagel/knife-vsphere/blob/master/lib/chef/knife/)  
> > Ba  
> > seVsphereCommand.rb
> > 
> > Randy
> > 
> > -----Original Message-----  
> > From: Jesse Campbell [[mailto:hikeit@gmail.com](mailto:hikeit@gmail.com)]  
> > Sent: Saturday, September 08, 2012 10:55 AM  
> > To: [chef@lists.opscode.com](mailto:chef@lists.opscode.com)  
> > Subject: [chef] Re: RE: Knife-vSphere plugin (windows)
> > 
> > What have you had work vs. not work?  
> > I'm pretty sure I tested both of those options back when I coded them,
> 
> > but it was many months ago, and I currently only test on mac os...  
> > but documentation around the "option" specifications is sparse or  
> > nonexistent, so some pieces may have been missed.
> > 
> > however, what variable is missing in what you posted? the first option
> 
> > sets config[:vsphere\_dc], the second option sets config[:vsphere\_host]
> > 
> > -jesse
> > 
> > On Wed, Sep 5, 2012 at 2:30 PM, Van Fossan,Randy [vanfossr@oclc.org](mailto:vanfossr@oclc.org)  
> > wrote:
> > 
> > > Well, I spoke too soon. I thought I tried the --vshost correctly  
> > > but, I still had the entry in my knife.rb file for the vsphere\_host.  
> > > Looking at the source for knife-vsphere; specifically, the  
> > > BaseVsphereCommand.rb file, it shows the --vshost but it doesn't look  
> > > like it is coded correctly.?.?.?
> > > 
> > > If you look at the vsphere\_dc section versus the vsphere\_host  
> > > section,  
> > > it looks like a variable is missing.?.?.?
> > > 
> > > option :vsphere\_dc,  
> > > :short =\> "-d DATACENTER",  
> > > :long =\> "--vsdc DATACENTER",  
> > > :description =\> "The Datacenter for vsphere"
> > > 
> > > option :vsphere\_host,  
> > > :long =\> "--vshost",  
> > > :description =\> "The vsphere host"
> > > 
> > > Anyone concur?
> > > 
> > > Randy
> > > 
> > > -----Original Message-----  
> > > From: Van Fossan,Randy  
> > > Sent: Wednesday, September 05, 2012 2:12 PM  
> > > To: 'chef@lists.opscode.com'  
> > > Subject: RE: Knife-vSphere plugin (windows)
> > > 
> > > After looking at the source, I see you can specify the Datacenter and  
> > > vSphere host. I tried it "-d" and --vshost options and they do work.
> > > 
> > > -----Original Message-----  
> > > From: Van Fossan,Randy  
> > > Sent: Wednesday, September 05, 2012 1:59 PM  
> > > To: 'chef@lists.opscode.com'  
> > > Subject: Knife-vSphere plugin (windows)
> > > 
> > > All,
> > > 
> > > I am having some success with the knife-vsphere (0.2.3) plugin in  
> > > windows. We have the Chef 0.10.12 Omnibus package for Windows  
> > > installed  
> > > and we then installed the knife-vsphere plugin. The plugin seems  
> > > to  
> > > work ok in windows after I did a little gem cleanup.. My question  
> > > is,  
> > > is there a way to pass the vsphere\_dc and vspere\_host via the command  
> > > line? I have tried setting windows environment variables as follows  
> > > and it isn't working.
> > > 
> > > vsphere\_host="mvcenter.fqdn"  
> > > vshrere\_dc="mydatacenter"
> > > 
> > > We have many Data Centers on multiple Virtual Center servers.
> > > 
> > > We need to run knife-vsphere on a windows chef management console due  
> > > to using VMware Orchestrator and PowerCLI as a wrapper around the  
> > > "knife vsphere" command.
> > > 
> > > Any suggestions?
> > > 
> > > Thanks  
> > > Randy

---

<div class="post-metadata">

**Author:** ![Van\_Fossan\_Randy](https://avatars.discourse-cdn.com/v4/letter/v/8797f3/32.png) [@Van\_Fossan\_Randy](https://discourse.chef.io/u/Van_Fossan_Randy)\
**Post date:** [September 10, 2012, 7:22pm UTC](https://discourse.chef.io/t/re-knife-vsphere-plugin-windows/3146/7 "2012-09-10T19:22:55Z")

</div>

Hi Jesse,

Well, I got a little farther. However the option for --cvlan do not  
seem to work. I made sure the VLAN value was correct. Note: I have  
sanitized the values so that I could publicly post the results.

C:\opscode\chef\bin\>knife vsphere vm clone --template "CentOS 5.8"  
"mytestvm.fqdn" --cvlan "123VLAN" -VV  
DEBUG: Using configuration from C:/Users/myacct/.chef/knife.rb  
DEBUG: value for config item bootstrap:  
DEBUG: value for config item vsphere\_host: myvcenter.fqdn  
DEBUG: value for config item vshere\_path:  
DEBUG: value for config item vsphere\_port: 443  
DEBUG: value for config item vsphere\_nossl:  
DEBUG: value for config item vsphere\_user: myacct  
DEBUG: value for config item vsphere\_pass: mypassword  
DEBUG: value for config item vsphere\_insecure: true  
DEBUG: value for config item vsphere\_dc: myvspheredc  
DEBUG: value for config item folder:  
DEBUG: value for config item vsphere\_dc: myvspheredc  
DEBUG: value for config item resource\_pool:  
DEBUG: value for config item vsphere\_dc: myvspheredc  
DEBUG: value for config item datastore:  
DEBUG: value for config item customization\_cpucount:  
DEBUG: value for config item customization\_memory:  
DEBUG: value for config item customization\_vlan: 123VLAN  
DEBUG: value for config item customization\_vlan: 123VLAN  
DEBUG: value for config item vsphere\_dc: myvspheredc  
C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/knife-vsphere-0.2.3/li  
b/chef/knife/vsphere\_vm\_clone.rb:256:in `rescue in generate_clo ne_spec': undefined method `deviceName=' for  
#\<RbVmomi::VIM::VirtualEthernetCardDistributedVirtualPortBackingInfo:0x4  
63e4e0\> (NoMethodE  
rror)  
from  
C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/knife-vsphere-0.2.3/li  
b/chef/knife/vsphere\_vm\_clone.rb:251:in `generate_ clone_spec' from C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/knife-vsphere-0.2.3/li b/chef/knife/vsphere_vm_clone.rb:188:in `run'  
from  
C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/  
knife.rb:402:in `run_with_pretty_exceptions' from C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/ knife.rb:168:in `run'  
from  
C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/  
application/knife.rb:123:in `run' from C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/bin/knife :25:in `\<top (required)\>'  
from C:/opscode/chef/bin/knife:19:in `load' from C:/opscode/chef/bin/knife:19:in `'

-----Original Message-----  
From: Jesse Campbell [[mailto:hikeit@gmail.com](mailto:hikeit@gmail.com)]  
Sent: Monday, September 10, 2012 12:02 PM  
To: [chef@lists.opscode.com](mailto:chef@lists.opscode.com)  
Subject: [chef] Re: RE: Re: RE: Re: RE: Knife-vSphere plugin (windows)

the documentation for mixlib::CLI is terrible, and I'm not even sure why  
not specifying something after ":long --vshost" switches from a boolean  
to a string, given that there is a :boolean element in the option  
hash...  
still digging...

-jesse

On Mon, Sep 10, 2012 at 11:55 AM, Van Fossan,Randy [vanfossr@oclc.org](mailto:vanfossr@oclc.org)  
wrote:

> Thanks Jesse, that worked..
> 
> Randy
> 
> -----Original Message-----  
> From: Jesse Campbell [[mailto:hikeit@gmail.com](mailto:hikeit@gmail.com)]  
> Sent: Monday, September 10, 2012 11:34 AM  
> To: [chef@lists.opscode.com](mailto:chef@lists.opscode.com)  
> Subject: [chef] Re: RE: Re: RE: Knife-vSphere plugin (windows)
> 
> looks like a bug in BaseVsphereCommand.rb I have changed the relevant  
> section to this:
> 
> ```
> option :vsphere_host,
> :long => "--vshost HOST",
> :description => "The vsphere host"
> 
> ```
> 
> You can update your own for now until a new rubygem is created.
> 
> What other changes did you need to make to run on windows?
> 
> -Jesse
> 
> On Mon, Sep 10, 2012 at 11:28 AM, Van Fossan,Randy [vanfossr@oclc.org](mailto:vanfossr@oclc.org)  
> wrote:
> 
> > Hi Jesse,
> > 
> > The following does not work, I get the error "can't convert true into

> > String"
> > 
> > # knife vsphere -u myaccount -p mypassword --vshost myhost.fqdn -d
> > 
> > "mydatacenter" --vsinsecure vm list # ERROR: TypeError: can't convert

> > true into String
> > 
> > If I change my knife.rb to include "knife[:vsphere\_host] =  
> > "myhost.fqdn" " and then run the following, it works.
> > 
> > # knife vsphere -u myaccount -p mypassword -d "mydatacenter"
> > 
> > --vsinsecure vm list
> > 
> > I need to be able to specify the --vshost as we have many Virtual  
> > Center Servers.
> > 
> > I looked at the code here:  
> > [https://github.com/ezrapagel/knife-vsphere/blob/master/lib/chef/knife](https://github.com/ezrapagel/knife-vsphere/blob/master/lib/chef/knife)  
> > /  
> > Ba  
> > seVsphereCommand.rb
> > 
> > Randy
> > 
> > -----Original Message-----  
> > From: Jesse Campbell [[mailto:hikeit@gmail.com](mailto:hikeit@gmail.com)]  
> > Sent: Saturday, September 08, 2012 10:55 AM  
> > To: [chef@lists.opscode.com](mailto:chef@lists.opscode.com)  
> > Subject: [chef] Re: RE: Knife-vSphere plugin (windows)
> > 
> > What have you had work vs. not work?  
> > I'm pretty sure I tested both of those options back when I coded  
> > them,
> 
> > but it was many months ago, and I currently only test on mac os...  
> > but documentation around the "option" specifications is sparse or  
> > nonexistent, so some pieces may have been missed.
> > 
> > however, what variable is missing in what you posted? the first  
> > option
> 
> > sets config[:vsphere\_dc], the second option sets  
> > config[:vsphere\_host]
> > 
> > -jesse
> > 
> > On Wed, Sep 5, 2012 at 2:30 PM, Van Fossan,Randy [vanfossr@oclc.org](mailto:vanfossr@oclc.org)  
> > wrote:
> > 
> > > Well, I spoke too soon. I thought I tried the --vshost correctly  
> > > but, I still had the entry in my knife.rb file for the vsphere\_host.  
> > > Looking at the source for knife-vsphere; specifically, the  
> > > BaseVsphereCommand.rb file, it shows the --vshost but it doesn't look

> > like it is coded correctly.?.?.?
> > 
> > > If you look at the vsphere\_dc section versus the vsphere\_host  
> > > section,  
> > > it looks like a variable is missing.?.?.?
> > > 
> > > option :vsphere\_dc,  
> > > :short =\> "-d DATACENTER",  
> > > :long =\> "--vsdc DATACENTER",  
> > > :description =\> "The Datacenter for vsphere"
> > > 
> > > option :vsphere\_host,  
> > > :long =\> "--vshost",  
> > > :description =\> "The vsphere host"
> > > 
> > > Anyone concur?
> > > 
> > > Randy
> > > 
> > > -----Original Message-----  
> > > From: Van Fossan,Randy  
> > > Sent: Wednesday, September 05, 2012 2:12 PM  
> > > To: 'chef@lists.opscode.com'  
> > > Subject: RE: Knife-vSphere plugin (windows)
> > > 
> > > After looking at the source, I see you can specify the Datacenter  
> > > and  
> > > vSphere host. I tried it "-d" and --vshost options and they do work.
> > > 
> > > -----Original Message-----  
> > > From: Van Fossan,Randy  
> > > Sent: Wednesday, September 05, 2012 1:59 PM  
> > > To: 'chef@lists.opscode.com'  
> > > Subject: Knife-vSphere plugin (windows)
> > > 
> > > All,
> > > 
> > > I am having some success with the knife-vsphere (0.2.3) plugin in  
> > > windows. We have the Chef 0.10.12 Omnibus package for Windows  
> > > installed  
> > > and we then installed the knife-vsphere plugin. The plugin seems  
> > > to  
> > > work ok in windows after I did a little gem cleanup.. My question  
> > > is,  
> > > is there a way to pass the vsphere\_dc and vspere\_host via the command  
> > > line? I have tried setting windows environment variables as follows  
> > > and it isn't working.
> > > 
> > > vsphere\_host="mvcenter.fqdn"  
> > > vshrere\_dc="mydatacenter"
> > > 
> > > We have many Data Centers on multiple Virtual Center servers.
> > > 
> > > We need to run knife-vsphere on a windows chef management console  
> > > due  
> > > to using VMware Orchestrator and PowerCLI as a wrapper around the  
> > > "knife vsphere" command.
> > > 
> > > Any suggestions?
> > > 
> > > Thanks  
> > > Randy

---

<div class="post-metadata">

**Author:** ![Jesse\_Campbell](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/jesse_campbell/32/251_2.png) [@Jesse\_Campbell](https://discourse.chef.io/u/Jesse_Campbell)\
**Post date:** [September 10, 2012, 9:27pm UTC](https://discourse.chef.io/t/re-knife-vsphere-plugin-windows/3146/8 "2012-09-10T21:27:11Z")

</div>

what do you get from "knife vsphere vlan list"?

On Mon, Sep 10, 2012 at 3:22 PM, Van Fossan,Randy [vanfossr@oclc.org](mailto:vanfossr@oclc.org) wrote:

> Hi Jesse,
> 
> Well, I got a little farther. However the option for --cvlan do not  
> seem to work. I made sure the VLAN value was correct. Note: I have  
> sanitized the values so that I could publicly post the results.
> 
> C:\opscode\chef\bin\>knife vsphere vm clone --template "CentOS 5.8"  
> "mytestvm.fqdn" --cvlan "123VLAN" -VV  
> DEBUG: Using configuration from C:/Users/myacct/.chef/knife.rb  
> DEBUG: value for config item bootstrap:  
> DEBUG: value for config item vsphere\_host: myvcenter.fqdn  
> DEBUG: value for config item vshere\_path:  
> DEBUG: value for config item vsphere\_port: 443  
> DEBUG: value for config item vsphere\_nossl:  
> DEBUG: value for config item vsphere\_user: myacct  
> DEBUG: value for config item vsphere\_pass: mypassword  
> DEBUG: value for config item vsphere\_insecure: true  
> DEBUG: value for config item vsphere\_dc: myvspheredc  
> DEBUG: value for config item folder:  
> DEBUG: value for config item vsphere\_dc: myvspheredc  
> DEBUG: value for config item resource\_pool:  
> DEBUG: value for config item vsphere\_dc: myvspheredc  
> DEBUG: value for config item datastore:  
> DEBUG: value for config item customization\_cpucount:  
> DEBUG: value for config item customization\_memory:  
> DEBUG: value for config item customization\_vlan: 123VLAN  
> DEBUG: value for config item customization\_vlan: 123VLAN  
> DEBUG: value for config item vsphere\_dc: myvspheredc  
> C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/knife-vsphere-0.2.3/li  
> b/chef/knife/vsphere\_vm\_clone.rb:256:in `rescue in generate_clo ne_spec': undefined method `deviceName=' for  
> #\<RbVmomi::VIM::VirtualEthernetCardDistributedVirtualPortBackingInfo:0x4  
> 63e4e0\> (NoMethodE  
> rror)  
> from  
> C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/knife-vsphere-0.2.3/li  
> b/chef/knife/vsphere\_vm\_clone.rb:251:in `generate_ clone_spec' from C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/knife-vsphere-0.2.3/li b/chef/knife/vsphere_vm_clone.rb:188:in `run'  
> from  
> C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/  
> knife.rb:402:in `run_with_pretty_exceptions' from C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/ knife.rb:168:in `run'  
> from  
> C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/  
> application/knife.rb:123:in `run' from C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/bin/knife :25:in `\<top (required)\>'  
> from C:/opscode/chef/bin/knife:19:in `load' from C:/opscode/chef/bin/knife:19:in `'
> 
> -----Original Message-----  
> From: Jesse Campbell [[mailto:hikeit@gmail.com](mailto:hikeit@gmail.com)]  
> Sent: Monday, September 10, 2012 12:02 PM  
> To: [chef@lists.opscode.com](mailto:chef@lists.opscode.com)  
> Subject: [chef] Re: RE: Re: RE: Re: RE: Knife-vSphere plugin (windows)
> 
> the documentation for mixlib::CLI is terrible, and I'm not even sure why  
> not specifying something after ":long --vshost" switches from a boolean  
> to a string, given that there is a :boolean element in the option  
> hash...  
> still digging...
> 
> -jesse
> 
> On Mon, Sep 10, 2012 at 11:55 AM, Van Fossan,Randy [vanfossr@oclc.org](mailto:vanfossr@oclc.org)  
> wrote:
> 
> > Thanks Jesse, that worked..
> > 
> > Randy
> > 
> > -----Original Message-----  
> > From: Jesse Campbell [[mailto:hikeit@gmail.com](mailto:hikeit@gmail.com)]  
> > Sent: Monday, September 10, 2012 11:34 AM  
> > To: [chef@lists.opscode.com](mailto:chef@lists.opscode.com)  
> > Subject: [chef] Re: RE: Re: RE: Knife-vSphere plugin (windows)
> > 
> > looks like a bug in BaseVsphereCommand.rb I have changed the relevant  
> > section to this:
> > 
> > ```
> > option :vsphere_host,
> > :long => "--vshost HOST",
> > :description => "The vsphere host"
> > 
> > ```
> > 
> > You can update your own for now until a new rubygem is created.
> > 
> > What other changes did you need to make to run on windows?
> > 
> > -Jesse
> > 
> > On Mon, Sep 10, 2012 at 11:28 AM, Van Fossan,Randy [vanfossr@oclc.org](mailto:vanfossr@oclc.org)  
> > wrote:
> > 
> > > Hi Jesse,
> > > 
> > > The following does not work, I get the error "can't convert true into
> 
> > > String"
> > > 
> > > # knife vsphere -u myaccount -p mypassword --vshost myhost.fqdn -d
> > > 
> > > "mydatacenter" --vsinsecure vm list # ERROR: TypeError: can't convert
> 
> > > true into String
> > > 
> > > If I change my knife.rb to include "knife[:vsphere\_host] =  
> > > "myhost.fqdn" " and then run the following, it works.
> > > 
> > > # knife vsphere -u myaccount -p mypassword -d "mydatacenter"
> > > 
> > > --vsinsecure vm list
> > > 
> > > I need to be able to specify the --vshost as we have many Virtual  
> > > Center Servers.
> > > 
> > > I looked at the code here:  
> > > [https://github.com/ezrapagel/knife-vsphere/blob/master/lib/chef/knife](https://github.com/ezrapagel/knife-vsphere/blob/master/lib/chef/knife)  
> > > /  
> > > Ba  
> > > seVsphereCommand.rb
> > > 
> > > Randy
> > > 
> > > -----Original Message-----  
> > > From: Jesse Campbell [[mailto:hikeit@gmail.com](mailto:hikeit@gmail.com)]  
> > > Sent: Saturday, September 08, 2012 10:55 AM  
> > > To: [chef@lists.opscode.com](mailto:chef@lists.opscode.com)  
> > > Subject: [chef] Re: RE: Knife-vSphere plugin (windows)
> > > 
> > > What have you had work vs. not work?  
> > > I'm pretty sure I tested both of those options back when I coded  
> > > them,
> > 
> > > but it was many months ago, and I currently only test on mac os...  
> > > but documentation around the "option" specifications is sparse or  
> > > nonexistent, so some pieces may have been missed.
> > > 
> > > however, what variable is missing in what you posted? the first  
> > > option
> > 
> > > sets config[:vsphere\_dc], the second option sets  
> > > config[:vsphere\_host]
> > > 
> > > -jesse
> > > 
> > > On Wed, Sep 5, 2012 at 2:30 PM, Van Fossan,Randy [vanfossr@oclc.org](mailto:vanfossr@oclc.org)  
> > > wrote:
> > > 
> > > > Well, I spoke too soon. I thought I tried the --vshost correctly  
> > > > but, I still had the entry in my knife.rb file for the vsphere\_host.  
> > > > Looking at the source for knife-vsphere; specifically, the  
> > > > BaseVsphereCommand.rb file, it shows the --vshost but it doesn't look
> 
> > > like it is coded correctly.?.?.?
> > > 
> > > > If you look at the vsphere\_dc section versus the vsphere\_host  
> > > > section,  
> > > > it looks like a variable is missing.?.?.?
> > > > 
> > > > option :vsphere\_dc,  
> > > > :short =\> "-d DATACENTER",  
> > > > :long =\> "--vsdc DATACENTER",  
> > > > :description =\> "The Datacenter for vsphere"
> > > > 
> > > > option :vsphere\_host,  
> > > > :long =\> "--vshost",  
> > > > :description =\> "The vsphere host"
> > > > 
> > > > Anyone concur?
> > > > 
> > > > Randy
> > > > 
> > > > -----Original Message-----  
> > > > From: Van Fossan,Randy  
> > > > Sent: Wednesday, September 05, 2012 2:12 PM  
> > > > To: 'chef@lists.opscode.com'  
> > > > Subject: RE: Knife-vSphere plugin (windows)
> > > > 
> > > > After looking at the source, I see you can specify the Datacenter  
> > > > and  
> > > > vSphere host. I tried it "-d" and --vshost options and they do work.
> > > > 
> > > > -----Original Message-----  
> > > > From: Van Fossan,Randy  
> > > > Sent: Wednesday, September 05, 2012 1:59 PM  
> > > > To: 'chef@lists.opscode.com'  
> > > > Subject: Knife-vSphere plugin (windows)
> > > > 
> > > > All,
> > > > 
> > > > I am having some success with the knife-vsphere (0.2.3) plugin in  
> > > > windows. We have the Chef 0.10.12 Omnibus package for Windows  
> > > > installed  
> > > > and we then installed the knife-vsphere plugin. The plugin seems  
> > > > to  
> > > > work ok in windows after I did a little gem cleanup.. My question  
> > > > is,  
> > > > is there a way to pass the vsphere\_dc and vspere\_host via the command  
> > > > line? I have tried setting windows environment variables as follows  
> > > > and it isn't working.
> > > > 
> > > > vsphere\_host="mvcenter.fqdn"  
> > > > vshrere\_dc="mydatacenter"
> > > > 
> > > > We have many Data Centers on multiple Virtual Center servers.
> > > > 
> > > > We need to run knife-vsphere on a windows chef management console  
> > > > due  
> > > > to using VMware Orchestrator and PowerCLI as a wrapper around the  
> > > > "knife vsphere" command.
> > > > 
> > > > Any suggestions?
> > > > 
> > > > Thanks  
> > > > Randy
