Hello Gurus,
I am thoroughly confued.
I want to create a audit script, partly to learn and partly to do the job. This script will check into each host and check for each vm if it has tols installed.
aNow from programming prespective fairly straight forward but which scripting tool do i use, power cli or vma?
I am unsure which will do the job in the most efficient way. Also maybe later if i use powercli, i want to have a windows gui built around it to do regular preset audits. is that do-able?
Please advice.
Thanks a lot
RJ
Hi RJ,
a PowerCLI script to check all the VM's for the tools status can be found in this forum. If you want to use it in a GUI, I would recommend PowerGUI.
Regards, Robert
This entirly depends on your scripting/programming background and the type of predominant OS you have in your environment.
If you're mostly a Windows-based shop, you will profit from learning PowerShell, since this is also the automation tool of choice for your Windows back-office applications (Exchange, SharePoint...)
If you're more a Linux-based shop, you're probably better of investing in Perl and the vMA.
Both offer nearly the same possibilities for managing your vSphere environment.
An added advantage for PowerShell/PowerCLI, I'm biased I have to admit , is that it tends to be more compact and offers better readability compared to Perl.
Have for example a look at script 2 in the recent Help with 2 simple scripts thread.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Here is a one line that you can run once connected to a vCenter, and it will list the tools status for all VMs.
You can also browse, to see how you can create a report (xls / html) but this line below will give you what you need.
Get-VM | Get-View | Select-Object @{N="Name";E={$_.Name}},@{Name="ToolsStatus";E={$_.Guest.ToolsStatus}}
Regards
Thanks,
I am using powergui.org editor. In that i type in the connect-viserver command in first line and pasted yours in next. I get error when i run it, it says not connected to any servers?
Why is it disconnecting from the connect command?
RJ
I use a vSPhere powerCLI..
I do not know if you do :
Connect-VIServer -Server <IP Address>
Then it will ask for your username / password
After you run the command.
This should work
Hello,
Thanks, i was not connecting right to the vcenter.
I tried - connvct-viserver -server localhost -protocol https -user localdomain\user.username -password abcd@8899
not working..
RJ
Are you doing this on the vCenter server ?
Any error messages ?
Try dropping the -Protocol parameter.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hey Luc,
Yes I am trying to do it on a vcenter.
This is the flow chart.
Log into VC ---> get-datacenter | get-host | get-vm --> check for tools installed and return name and status
the vc has many other linked vc and also many data centers in it.
I dont want the script because i want to be able to learn as i write it.
Just guidance.
Thanks again!
Ok, let's take it step by step.
The Connect-VIserver doesn't work you say.
Are you doing this from a PowerCLI prompt ?
If not, can you try ?
Do you get any error messages ?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Ooops,
sorry guys it was wrong password all the way. Another thing i noticed is that powercli executes line by line, what i mean is top to bottom execution. Can it do objects oriented, functions and all. Any example or tutorial on how to create functions?
Thanks
RJ
No problem, glad that problem is fixed.
Yes, PowerCLI can do all that.
Start with a good PowerShell introduction to get the basics.
PowerCLI is just s snapin that is loaded on top of PowerShell.
There are links to some good (free) resources in my My PS library post.
I highly recommend Tobias's PS ebook.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
As a side note. Maby it is also worth to start with commandassist which relies on show-ui
http://blog.usepowershell.com/2011/08/announcing-commandassist/
regards
Andreas