Quantcast
Channel: VMware Communities : All Content - All Communities
Viewing all articles
Browse latest Browse all 183671

how to run a command in background ?

$
0
0

Hello there,

 

is it possible to run powercli command in backgroud?

what I mean is that; for example there is a datastore named "XXX" and there are 40 VMs in it. I need to shutdown all of them. when I try following script it waits for every VM to shutdown and then next VM etc. if for example "shutdown" command starts in background for each VM then script will finish quickly. and so, shutdown process for all 40 Vms starts in parallel. is it possible?

 

$datastore = "XXX"

$vms = get-vm -datastore (get-datastore $datastore)

foreach ($vm in $vms) {
     Get-VM $vm| Where-Object {$_.PowerState -eq "PoweredOn" -and $_.Guest.State -eq "Running"} | Shutdown-VMGuest -Confirm:$false
}

 

for example in unix, linux system if I add "&" to end of the command then it works in background. is there anything like this?

 

Thank you.


Viewing all articles
Browse latest Browse all 183671

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>