Background. Regulation of the immune system is critical for fighting against viral infections. Both suppression and hyperactivity of the immune system result in failure of treatment. The present study was designed to show the effects of immune system-related medications on mortality and length of stay (LOS) in a cohort of Iranian patients with coronavirus disease 2019 (COVID-19). Methods. A data mining study was performed on 6417 cases of COVID-19 covered by 17 educational hospitals of Iran University of Medical Sciences, Tehran. Association of a researcher-designed drug list with death and LOS was studied. For death outcome, logistic regression was used reporting odds ratio (OR) with 95% confidence interval (CI). For LOS, right censored Poisson regression was used reporting incidence rate ratio (IRR) with 95% CI. Results. Among the corticosteroids, prednisolone was a risk factor on death (
OR
=
1.41
,
95
%
CI
=
1.03
−
1.94
). This association was increased after adjustment of age interactions (
OR
=
3.45
,
95
%
CI
=
1.01
−
11.81
) and was removed after adjustment of ICU admission interactions (
OR
=
2.64
,
95
%
CI
=
0.70
−
9.92
). Hydroxychloroquine showed a protecting effect on death (
OR
=
0.735
,
95
%
CI
=
0.627
−
0.862
); however, this association was removed after adjustment of age interactions (
OR
=
0.76
,
95
%
CI
=
0.41
−
1.40
). Among the antivirals, oseltamivir showed a protecting effect on death (
OR
=
0.628
,
95
%
CI
=
0.451
−
0.873
); however, this association was removed after adjustment of age interactions (
OR
=
0.45
,
95
%
CI
=
0.11
−
1.82
). For reduction of LOS, the only significant association was for hydroxychloroquine (
IRR
=
0.85
,
95
%
CI
=
0.79
−
0.92
). Conclusion. The results of such data mining studies can be used in clinics until completing the evidence. Hydroxychloroquine may reduce mortality in some specific groups; however, its association may be confounded by some latent variables and unknown interactions. Administration of corticosteroids should be based on the conditions of each case.