VMware Cloud Community
240ZeusPB
Contributor
Contributor

More VI4 VUM Automation Fun

Hopefully I'm posting this in the correct forum since I'm using PS to make these SDK calls. If I'm in the wrong place mod please move this thread.

I've spent multiple days figuring out if there is any way to automate VI4 VUM scanning and remediation with not alot of success. I realize the PS cmdlets are not there anymore in PowerCLI, the old versions don't work against VI4, etc.... However, I did run across the SDK documentation and am playing around with performing the scheduled task creation for simple scan and remediate tasks. I have successfully created a scan task and it is getting kicked off - but stays at the "Queued" status for the task in VC and I get the following errors from hostd.log on the ESX server (3.5U4):

2010-02-09 20:54:44.989 'PropertyCollector' 85945264 warning GetPropertyProvider failed for haTask-ha-host-vim.host.FirewallSystem.enableRuleset-111151

2010-02-09 20:55:05.190 'PropertyCollector' 3076424608 warning GetPropertyProvider failed for haTask-ha-host-vim.host.PatchManager.Scan-111152

2010-02-09 20:55:06.199 'PropertyCollector' 85945264 warning GetPropertyProvider failed for haTask-ha-host-vim.host.FirewallSystem.disableRuleset-111154

LucD, I found a PS script you referenced the SDK for to PowerOn a VM, I've modified for my use and here it is:

$esxview = Get-View (Get-VMHost host.hello.com).ID

$cta = New-Object VMware.Vim.CreateTaskAction

$cta.Cancelable = $true

$cta.TaskTypeId = "com.vmware.vcIntegrity.ScanTask"

$dTScheduler = New-Object VMware.Vim.DailyTaskScheduler

$dTScheduler.Hour = 01

$dTScheduler.Minute = 01

$dTScheduler.Interval = 1

$tSpec = New-Object VMware.Vim.ScheduledTaskSpec

$tSpec.Action = $cta

$tSpec.Description = "Scan this test Host."

$tSpec.Enabled = $true

$tSpec.Name = "VUM Scan Automated"

$tSpec.Notification = "hi@hello.com"

$tSpec.Scheduler = $dTScheduler

$svcRef = new-object VMware.Vim.ManagedObjectReference

$svcRef.Type = "ServiceInstance"

$svcRef.Value = "ServiceInstance"

$serviceInstance = get-view $svcRef

$stMgr = Get-View ($serviceInstance.Content.ScheduledTaskManager)

$stMgr.CreateScheduledTask($esxview.MoRef,$tSpec)

Thanks for any help anyone can offer me. Alternatively, if anyone has figured out the syntax of vmware-vcicli that comes with VI4 VUM, can you please share that with me? I have been able to perform several functions with it, but I keep getting errors when trying the --stage and --remediate options which is what I really need.

Z

0 Kudos
7 Replies
admin
Immortal
Immortal

Hi,

Sorry, there isn't a supported way of automating VUM 4.0 right now. However, we have been working double time on this and the PowerCLI toolkit for VUM 4.0 U1 is being released within the next month. If you would like to work with a preview version of the toolkit, please get in touch with me ... sraghuram at vmware . com

The toolkit is compatible with the 4.0 U1 version of VUM.

Thanks.

PS: Please don't use vmware-vcicli; use the upcoming PowerCLI instead

0 Kudos
lamw
Community Manager
Community Manager

Good to hear you guys are bringing back VUM to PowerCLI ... though I would prefer to see the VUM APIs be exposed as standard web Services like the vSphere API, that way we can get bindings such as the vSphere SDK for Perl or VI Java for those that don't use PowerCLI to manage their VMware environments such as myself and many many others Smiley Happy

=========================================================================

William Lam

VMware vExpert 2009

VMware ESX/ESXi scripts and resources at:

Twitter: @lamw

VMware Code Central - Scripts/Sample code for Developers and Administrators

VMware Developer Comuunity

If you find this information useful, please award points for "correct" or "helpful".

0 Kudos
LucD
Leadership
Leadership

Even though I use PowerCLI, I would also like to see the VUM APIs being exposed.

____________

Blog: LucD notes

Twitter: lucd22


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

0 Kudos
admin
Immortal
Immortal

Yup; we hear you. I cannot commit to a timeframe on this yet, but rest assured we are aware of the need. Thanks.

0 Kudos
ayush17
Contributor
Contributor

Hi,

I am actually working on the similar kind of project and wanted to call VUM operations programmatically, so just needed an update, are there any APIs exposed now or is there any other way to do it

thanks

0 Kudos
LucD
Leadership
Leadership

Not afaik, the PowerCLI cmdlets are the only option.


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

0 Kudos
ayush17
Contributor
Contributor

okay, thanks for you help

0 Kudos