Quantcast
Channel: VMware Communities : All Content - All Communities
Viewing all articles
Browse latest Browse all 207710

How do I register all VMX files found in a list of datastores with new names

$
0
0

Hello-

 

I am trying to come up with a way to search through a given list of datastores, and upon each find of a .VMX file, re-add that machine to inventory only I would like to prefix the name of the machine as something different. Ie, instead of "Machine1", I would like it to be registetred as "auto-Machine1".  So imagine I have an empty datacenter with 4 datastores stored in an array $arrDatastoreToInclude,.  I would like to loop through each of those datastores and add all the VMX files I find back to inventory.

 

I know that I can use the following to get the datastores I want:

 

$dsindatacenter = Get-DataCenter $DataCenterName | Get-Datastore | ?{$arrDatastoreToInclude -contains $_.Name}

 

But I have no idea how to scan those datastores for VMX files and what command to add them back into inventory.  Can anyone help?


Viewing all articles
Browse latest Browse all 207710

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>