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
link|improve this question
feedback

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.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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