www.vmwareadmins.com

how many VMs can you put in a box?

  • Increase font size
  • Default font size
  • Decrease font size
Welcome to VMwareAdmins.com!

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)"

 

 

Last Updated on Tuesday, 03 August 2010 12:07
 

Powershell Save-As Bug with Excel

E-mail Print PDF

Per: http://www.techdecode.com/wp/?p=58

 

When saving to Excel with PS, we were getting an exception calling “SaveAs” with “1″ argument(s): “SaveAs method of Workbook class failed”

So trying to find an answer with google, we stumbled across the above link... which pointed us in the direction below.

・Windows 2008 Server x64
Please make this folder.

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

・Windows 2008 Server x86
Please make this folder.

C:\Windows\System32\config\systemprofile\Desktop   

yes, literally create the above folder and it magically works... MS, you make me mad.

Last Updated on Monday, 02 August 2010 12:41
 


Page 2 of 22

Follow Me On...

Facebook linkedin twitter youtube

Polls

What Version of vSphere are you purchasing?