Sometimes, we don't need to interact with the compromised host on the fly. In such situations, we can instruct Metasploit to background the newly created session as soon as a service is exploited using the -z switch, as follows:

As we can see that we have a command shell opened, it is always desirable to have better-controlled access like the one provided by Meterpreter. In such scenarios, we can upgrade the session using the -u switch, as shown in the following screenshot:

Amazing! We just updated our shell to a Meterpreter shell and gained better control of the target.