VMware Cloud Community
Virtualinfra
Commander
Commander
Jump to solution

Script to run emcgrab.exe across multiple esxi using powershell

any idea to script to run emcgrab.exe across multiple esxi using powershell.

the option to be used as below.

emcgrab.exe -host XXXXX(hostname) -user root -password XXXX -vmsupport -party XXX -customer XXX -case XXX -contact XXX -phone XXXX -email XXXX

Thanks & Regards Dharshan S VCP 4.0,VTSP 5.0, VCP 5.0
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

Then you can do something like this.

It assumes there is 1 hostname per line, no blank lines.

$user = 'root'

$pswd = 'XXXX'

Get-Content -Path hostnames.txt | %{

    emcgrab.exe -host $_ -user $user -password $pswd -vmsupport -party XXX -customer XXX -case XXX -contact XXX -phone XXXX -email XXXX

}


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

8 Replies
LucD
Leadership
Leadership
Jump to solution

You mean like this?

It assumes you are connected to the vCenter (Connect-VIServer).

$user = 'root'

$pswd = 'XXXX'

Get-VMHost | %{

    emcgrab.exe -host $_.NetworkInfo.HostName -user $user -password $pswd -vmsupport -party XXX -customer XXX -case XXX -contact XXX -phone XXXX -email XXXX

}


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
Virtualinfra
Commander
Commander
Jump to solution

Thanks for quick help.

similar to that but not connected to vcenter, list of host in a text file and loaded from there.

Thanks & Regards Dharshan S VCP 4.0,VTSP 5.0, VCP 5.0
0 Kudos
LucD
Leadership
Leadership
Jump to solution

Then you can do something like this.

It assumes there is 1 hostname per line, no blank lines.

$user = 'root'

$pswd = 'XXXX'

Get-Content -Path hostnames.txt | %{

    emcgrab.exe -host $_ -user $user -password $pswd -vmsupport -party XXX -customer XXX -case XXX -contact XXX -phone XXXX -email XXXX

}


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Virtualinfra
Commander
Commander
Jump to solution

Thanks Lucd, works perfectly!!!

Thanks & Regards Dharshan S VCP 4.0,VTSP 5.0, VCP 5.0
0 Kudos
Sureshkumarsain
Contributor
Contributor
Jump to solution

LucD, Thank you  Very much for the  script ,  Its working like champ but its asking  Yes  and no for Legal agreement and for service request number  for every host.

Please help   me on this.

0 Kudos
LucD
Leadership
Leadership
Jump to solution

I don't know this emcgrab.exe, but with the help of Google, it looks as if there a number of parameters you can use to make it run silent.

Try adding the -quiet and -autoexec parameters.

If these don't work, check if the list of parameters includes those two.

You should be able to do that by adding the -h parameter.

But like I said, I don't know this command, nor do I have a copy to try it out.
Worst case, ask on one of the EMC fora.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
RAJ_RAJ
Expert
Expert
Jump to solution

Hi  ,

I hope  below link will help you understand this

EMC Community Network - DECN: EMC Grabs for ESXi

ftp://ftp.emc.com/pub/emcgrab/ESXi/Readme_ESXiGrab_v1.3.7.txt

RAJESH RADHAKRISHNAN VCA -DCV/WM/Cloud,VCP 5 - DCV/DT/CLOUD, ,VCP6-DCV, EMCISA,EMCSA,MCTS,MCPS,BCFA https://ae.linkedin.com/in/rajesh-radhakrishnan-76269335 Mark my post as "helpful" or "correct" if I've helped resolve or answered your query!
0 Kudos
Sureshkumarsain
Contributor
Contributor
Jump to solution

Thank you  Very  Much RAJ  and LucD

Its working now and I missed  2 switch for EMCGRAB

0 Kudos