Hello,
I will make a bat script that call a powercli script up.
This powercli must check that the server is up or down when the server is down he must start the server.
When the sever is up the bat scrip must run further.
After the bat file has run succesful the server must be going down.
(the bat file coppy some directories from a other server to the template)
Can somebody help me with writing this script ?
I've try this but it didn't work
Connect to every vSphere host in the cluster that contains vCenter
Connect-VIServer -Server 192.168.163.186 -Protocol https -User xxx -Password xxx
Start vCenter
Get-VM -name DA-WWWT | Start-VM
What exactly didn't work with the lines you included at the end of your post ?
The connection to the ESX(i) server or starting the vCenter guest ?
When your connected, does Get-VM return anything ?
____________
Blog: LucD notes
Twitter: lucd22
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
The lines work when I put them in the command prompt.
But if I try to this with a script its failed
Maybe you can say me how you call the script up from a bat-file.
Have a look at Alan's post Running a PowerCLI Scheduled task.
In that post you will see how to run a PowerShell script from a DOS CMD line or a BAT file.
____________
Blog: LucD notes
Twitter: lucd22
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference