www.vmwareadmins.com

how many VMs can you put in a box?

  • Increase font size
  • Default font size
  • Decrease font size
Home Articles Running PowerCLI from vOrchestrator

Running PowerCLI from vOrchestrator

E-mail Print PDF

So instead of running the mind-numbing senseless reports every Friday for management manually, why don't we automate this?

In vOrchestrator, create a new workflow, drop in a scriptable task, and use the following code:

command = new Command("cmd.exe /c powershell.exe -File c:\\orchestrator\\excelForecastV2.ps1 c:\\orchestrator\\excelForecastV2err.log");
command.executeAndLog("c:\\orchestrator\\workflow.log");

Pretty straightforward huh?

The tricky part comes within the script and the vOrchestrator host..

First, on the vOrchestrator host, I had to create the following directory:

C:\Windows\SysWOW64\config\systemprofile\Desktop    

and since I'm querying multiple vCenter servers, I had to stick this into my script as well:

Set-PowerCLIConfiguration -DefaultVIServerMode "Multiple" -Confirm:$false

and at the end of the script, mail me (and management) the report!

(codecitation will not correctly format the command below Frown)

send-mailmessage -SmtpServer "mailhost.dev.org" -to " This e-mail address is being protected from spambots. You need JavaScript enabled to view it " -cc " This e-mail address is being protected from spambots. You need JavaScript enabled to view it " -from "VMware Orchestrator " -subject "VMware Forecast - $($date)-$($time)" -Attachments "$($filepath)\$($date)-$($time)-$($filename)"

 

 

 

Follow Me On...

Facebook linkedin twitter youtube