Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Is there a script to input to exit VMware vSphere PowerCLI command prompt after executing a set of script for example created of VM.

MY last line of my .ps1 script is shown below, but the exit does not work, after executing my script, the command prompt is still there, unlike windows command prompt as the exit command works but not in powercli.

New-VM -name $vm  -DiskMB 10000 -memoryMB 4000
New-CDDrive -VM $vm -ISOPath  $win7 -StartConnected:$true -Confirm:$false
$scsiController = Get-HardDisk -VM $vm | Select -First 1 | Get-ScsiController
Set-ScsiController -ScsiController $scsiController -Type VirtualLsiLogicSAS -Confirm:$false

Start-VM -vm $vm
Exit
share|improve this question
add comment

1 Answer

You can tag an exit on the command line after the script call. Example

.\runmyscript.ps1;exit

Will run your script then close the shell wfter your script exits.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.