Start a Conversation

Solved!

Go to Solution

2433

September 14th, 2020 04:00

How to check if a VMware VM folder exists using a Networker CLI command?

Suppose that the Networker has established the connection to a vCenter and the vProxy has been deployed. Is there a way of using a Networker CLI command to check if a VM folder exists in the vCenter? A user inputs a string as the folder name. As the vSphere VM folder name is case sensitive, it is better to ensure the name is correct and the corresponding folder exists before proceeding. I know I could install vSphere PowerCLI on the Networker server to create a simple PowerCLI script to check directly against the vCenter. But if possible, I’d rather avoid installing another piece of software on the Networker server. Does anyone have experience of using the NSR hypervisor resource? Is there a way to form a query with NSR hypervisor resource to check a folder? Any help would be appreciated.

40 Posts

September 19th, 2020 07:00

As I didn't see any suggestion about how to check VM folder with a Networker CLI command and how to use the NSR hypervisor resource, I ended up with the installing vSphere PowerCLI on the Networker server and use a simple PowerCLI script to check the existence of a VM folder in the vCenter.

BTW, I noticed that if there are multiple VM folders with the same name but different folder paths in a vCenter, a dynamic Protection Group using a NSR Rule with the folder name will include the VMs from all the folders. Is there a way to specify the full folder path in a NSR rule or do we have to manually exclude the VMs from other folders from the group?

I will mark the update as a "solution" to close this thread.

40 Posts

October 26th, 2020 07:00

It seems it is possible to specify a full VM folder path in a NSR rule. The trick is to specify 'Path', instead of 'Name' in the Property in the rule definition. The Value will be the full VM folder path in a format of '/DC/folder1/subfolder2'.

So the full rule definition looks like

  • Type: VmFolder
  • Property: Path
  • Operator: Equals
  • Value: /DC/folder1/subfolder2

Please note a VM folder path is case sensitive and there should be a '/' in front of the datacenter and there is no '/' at the end. Don't include the internal 'vm' folder in the path.

Hope this helps.

No Events found!

Top