VMware Cloud Community
jasonboche
Immortal
Immortal
Jump to solution

Scripting a few deployment parameters

Does anyone have any success on scripting either of the following two changes in an ESXi deployment? I'm not seeing options for these in the vMA. PowerShell is an option however ideally I'd like this done with vMA or even RCLI:

1) Change the default datstore name assigned by adding the host name to it.

2) Enable Management Network on a port group.

Thank you,

Jas






[i]Jason Boche, vExpert[/i]

[boche.net - VMware Virtualization Evangelist|http://www.boche.net/blog/][/i]

[VMware Communities User Moderator|http://www.vmware.com/communities/content/community_terms/][/i]

[Minneapolis Area VMware User Group Leader|http://communities.vmware.com/community/vmug/us-central/minneapolis][/i]

[vCalendar|http://www.boche.net/blog/index.php/vcalendar/] Author[/i]

VCDX3 #34, VCDX4, VCDX5, VCAP4-DCA #14, VCAP4-DCD #35, VCAP5-DCD, VCPx4, vEXPERTx4, MCSEx3, MCSAx2, MCP, CCAx2, A+
Reply
0 Kudos
1 Solution

Accepted Solutions
lamw
Community Manager
Community Manager
Jump to solution

Script has been updated to support renaming from both vCenter and directly connecting to ESX(i) host. There is an explanation with the bug you may have found ....

=========================================================================

William Lam

VMware vExpert 2009

VMware ESX/ESXi scripts and resources at:

Twitter: @lamw

VMware Code Central - Scripts/Sample code for Developers and Administrators

VMware Developer Comuunity

If you find this information useful, please award points for "correct" or "helpful".

View solution in original post

Reply
0 Kudos
9 Replies
lamw
Community Manager
Community Manager
Jump to solution

Take a look at these two scripts that I just wrote using vSphere SDK for Perl which is what the vCLI scripts are created from:

1)

2)

=========================================================================

William Lam

VMware vExpert 2009

VMware ESX/ESXi scripts and resources at:

Twitter: @lamw

VMware Code Central - Scripts/Sample code for Developers and Administrators

VMware Developer Comuunity

If you find this information useful, please award points for "correct" or "helpful".

jasonboche
Immortal
Immortal
Jump to solution

Thanks a lot William! I will take a look at these.

Jas






[i]Jason Boche, vExpert[/i]

[boche.net - VMware Virtualization Evangelist|http://www.boche.net/blog/][/i]

[VMware Communities User Moderator|http://www.vmware.com/communities/content/community_terms/][/i]

[Minneapolis Area VMware User Group Leader|http://communities.vmware.com/community/vmug/us-central/minneapolis][/i]

[vCalendar|http://www.boche.net/blog/index.php/vcalendar/] Author[/i]

VCDX3 #34, VCDX4, VCDX5, VCAP4-DCA #14, VCAP4-DCD #35, VCAP5-DCD, VCPx4, vEXPERTx4, MCSEx3, MCSAx2, MCP, CCAx2, A+
Reply
0 Kudos
jasonboche
Immortal
Immortal
Jump to solution

The portgroup script works for assigning the management network.

The rename-datastore script isn't working against ESXi 4. The script output gives the appearance of working, however, the datastore name does not change.

$ ./esxcfg-rename-datastore.pl --server solo.boche.mcse --datastore datastore1 --name newname --username root --password xxxxxxxx

Found datastore1!

Renaming "datastore1" to "newname" ...

Sucessfully renamed datastore!






[i]Jason Boche, vExpert[/i]

[boche.net - VMware Virtualization Evangelist|http://www.boche.net/blog/][/i]

[VMware Communities User Moderator|http://www.vmware.com/communities/content/community_terms/][/i]

[Minneapolis Area VMware User Group Leader|http://communities.vmware.com/community/vmug/us-central/minneapolis][/i]

[vCalendar|http://www.boche.net/blog/index.php/vcalendar/] Author[/i]

VCDX3 #34, VCDX4, VCDX5, VCAP4-DCA #14, VCAP4-DCD #35, VCAP5-DCD, VCPx4, vEXPERTx4, MCSEx3, MCSAx2, MCP, CCAx2, A+
Reply
0 Kudos
lamw
Community Manager
Community Manager
Jump to solution

Script has been updated to support renaming from both vCenter and directly connecting to ESX(i) host. There is an explanation with the bug you may have found ....

=========================================================================

William Lam

VMware vExpert 2009

VMware ESX/ESXi scripts and resources at:

Twitter: @lamw

VMware Code Central - Scripts/Sample code for Developers and Administrators

VMware Developer Comuunity

If you find this information useful, please award points for "correct" or "helpful".

Reply
0 Kudos
cskowmh
Enthusiast
Enthusiast
Jump to solution

I played around with this a little and it seems a little touchy. The --name parameter doesn't seem to work at all unless you specify --datastore, which isn't the behavior that I'm looking for. I wanted to standardize my datastores with a name like LOCAL-$SHORTHOSTNAME. Can't seem to get that to work if they've been joined to vCenter because it renames it to a datastore1 (1) or datastore1 (2) or the like.

It also seems to keep appending the FQDN on the end of the datastore for each run, which might be a little dangerous Smiley Happy

Great concept, with some polish this will definitely help a lot of people!

Reply
0 Kudos
lamw
Community Manager
Community Manager
Jump to solution

So the script can be highly customizable, it can do all that you have mentioned but all I had to go off of was a simple request to rename an existing datastore and the assumption was this would be used for newly provisioned ESX(i) hosts. Some may want only specific datastores, others may want ALL datastores and what to append or prepend text can differ.

I'll think about updating it to support few additional options including FQDN and non-FQDN ... again these are all personal preferences and every user of the script will have an idea of what the script 'should' do, so hopefully you see it from my perspective as well.

=========================================================================

William Lam

VMware vExpert 2009

VMware ESX/ESXi scripts and resources at:

Twitter: @lamw

VMware Code Central - Scripts/Sample code for Developers and Administrators

VMware Developer Comuunity

If you find this information useful, please award points for "correct" or "helpful".

Reply
0 Kudos
cskowmh
Enthusiast
Enthusiast
Jump to solution

William,

Believe me when I say that all of us enjoy using many of your scripts. Please don't take my comment earlier as something that expected you to make the script all things to all people. I was just noting that when I'm trying to edit my newly deployed cluster using the --name parameter doesn't work without a datastore, and because vcenter has already renamed all the datastore1's that were built to have a suffix such as (1) or (2), etc, I can't just put a --datastore of datastore1, meaning I can't use a custom name unfortunately.

Thats all I meant by my post, sorry if that came harshly at all. Before you posted that I had just used your health script on the servers!

Reply
0 Kudos
lamw
Community Manager
Community Manager
Jump to solution

Take a look a the updated version of the script: .

Hopefully the new features and use case will make the script a little bit more comfortable to play with Smiley Wink

Thanks again for the feedback and suggestions. I did not take you previous reply as an expectation but wanted to let you know that the limitation was not in the script but only the currently supported use cases. The possibilities are endless when you're talking about scripting automation, the limit is in the mind and hence that is why I enjoy scripting various solutions to help users automate their infrastructure.

=========================================================================

William Lam

VMware vExpert 2009

VMware ESX/ESXi scripts and resources at:

Twitter: @lamw

VMware Code Central - Scripts/Sample code for Developers and Administrators

VMware Developer Comuunity

If you find this information useful, please award points for "correct" or "helpful".

jasonboche
Immortal
Immortal
Jump to solution

Thank you for the update.






[i]Jason Boche, vExpert[/i]

[boche.net - VMware Virtualization Evangelist|http://www.boche.net/blog/][/i]

[VMware Communities User Moderator|http://www.vmware.com/communities/content/community_terms/][/i]

[Minneapolis Area VMware User Group Leader|http://communities.vmware.com/community/vmug/us-central/minneapolis][/i]

[vCalendar|http://www.boche.net/blog/index.php/vcalendar/] Author[/i]

VCDX3 #34, VCDX4, VCDX5, VCAP4-DCA #14, VCAP4-DCD #35, VCAP5-DCD, VCPx4, vEXPERTx4, MCSEx3, MCSAx2, MCP, CCAx2, A+
Reply
0 Kudos