Thanks LucD....that's all I needed...the push in the right direction w/ the cmdlet. I appreciate the help!!
For those of you just getting started w/ scripting in VMware, here's what I did w/ my script.
Note: My requirement here is to clone a VM into 2 differenet VM's every night, hence my needing to delete the VM's on a nightly basis. So, before the clone job in Vcenter runs, I run the following script:
Connect-VIServer cwvcenter -User myvcenteruser -Password ########
Get-VM demo | Stop-VM -Confirm:$false
Start-Sleep -Seconds 10
Get-VM demo | Remove-VM -DeleteFromDisk -Confirm:$false
Start-Sleep -Seconds 10
Get-VM train | Stop-VM -Confirm:$false
Start-Sleep -Seconds 10
Get-VM train | Remove-VM -DeleteFromDisk -confirm:$false
Notes about the above script:
So, at this point, I've got my script to do what I need. It powers down the VM's, and then deletes them. Vcenter comes in a little while later & clones the "source" VM and customizes w/ the customization templates.
However....I was then stuck with the question "How do I schedule this? There has to be a way to do it w/ a Windows scheduled task". After some research and testing, I found a way to do it.
I wrote a batch file that the windows scheduled task calls on a nightly basis. The batch file syntax is as such:
C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe -PSconsolefile "C:\Program Files\VMware\Infrastructure\VIToolkitForWindows\vim.psc1" -command C:\scripts\main-train-poweroffanddelete.ps1
I then scheduled the task to use the batch file, and it works exactly how I wanted it to.
I hope this helps anyone in the future that is getting into powershell/VItoolkit scripting in your VMware Infrastructures.