This post is more than 5 years old
155 Posts
0
4713
How to add VM client from CLI
Hi CLI Lovers,
Has anyone ever used CLI to add VM clients into Avamar? I know the procedure to add it into a group but from what I have tested it first needs to be imported and then can be added into a group
Amol
207 Posts
0
December 5th, 2016 08:00
If you know the exact path of the VM (folder path) on the vCenter you could use the following mccli command
mccli client add --type=vmachine --name=vmname --datacenter=datacentername --folder=/foldername/leve1/level2/ --domain=/VcenterName/VirtualMachines/
If you have proxycp.jar then you can run the following command
java -jar proxycp.jar --addvm --vc --vm
Regards
Amol Powar
Amol
207 Posts
0
December 5th, 2016 10:00
proxycp 2.78 should have --addvm option, it should also work on Avamar 7.2.
Are you getting any particular error while using this options
umichklewis
1.2K Posts
0
December 5th, 2016 10:00
Is this only on Avamar 7.3? I don't see it on 7.2. I upgraded to the latest proxycp.jar version 2.78.
umichklewis
1.2K Posts
0
December 5th, 2016 11:00
Aha! I discovered my error! The curl command updated the version in /usr/local/avamar/bin, but my sudo command was running against the file in the ~admin directory. Got pointed to the one in /usr/local/avamar/bin and all is well.
Thanks much!
Karl
Anirban_S
3 Posts
0
August 17th, 2018 08:00
How to add Multiple Clients Using this --addvm Command? Can we use a Text File with --filename?
Please let me know.
umichklewis
1.2K Posts
0
August 20th, 2018 14:00
An easy way is to simply put all the VMs in a file, with each VM name on a line. Then you can run a simple 'for' loop on the CLI to add each VM in sequence.
Let us know if that helps!
Karl
Anirban_S
3 Posts
0
August 21st, 2018 08:00
Thanks for the Response,
Can Please Help me with the Exact Command with 'for' loop?
Below is the Command to add a Particular VM to a Particular Domain,
java -jar proxycp.jar --addvm --vc --vm --domain
umichklewis
1.2K Posts
1
August 28th, 2018 13:00
I will start by assuming that you'll use the same VMware vCenter name and same Domain in your list, and only the VM name will change. For this, I would create a text file called "vm.txt" that contained each VM name on its own line and no other characters, i.e.
VM1
VM2
VM3
etc.
If you're trying to build this file on a Windows computer in a text editor, be 100% sure your file is encoded for ASCII.
I would next make a file called "rename.sh" on the Utility Node and put in the following:
#!/bin/bash
for i in `cat vm.txt`
do
java -jar proxycp.jar --addvm --vc my.vcenter.org --vm $i --domain my.domain.org
done
What this does is simply read each line in the file and run the command against the VM name. In the above script, you may also need to provide the full path to the java command or to the proxycp.jar file, depending on your shell environment and path settings.
Let us know if that helps!
Karl
Anirban_S
3 Posts
1
August 31st, 2018 06:00
Thanks Karl, It worked.