In this article, I introduce the gtsheckman command, which estimates a generalized two-step Heckman sample-selection estimator adjusted for heteroskedasticity. This estimator has been previously proposed in Carlson and Joshi (2024, Journal of Applied Econometrics 39: 237-255), where the presence of heteroskedasticity was motivated by a panel-data setting with random coefficients. The gtsheckman command offers several advantages over the heckman, twostep command, including robust inference, a more general control function specification, and the incorporation of heteroskedasticity. I discuss syntax and the underlying methodology and provide examples showing how the gtsheckman command can be used in a variety of settings