Context. It is a challenge to study the formation process of massive stars: their formation time is short, there are only few of them, they are often deeply embedded, and they lie at relatively large distances. Our strategy is to study the outcome of the star formation process and to search for signatures that remain of the formation. We have access to a unique sample of (massive) pre-main-sequence (PMS) stars in the giant H II region M17. These PMS stars can be placed on PMS tracks in the Hertzsprung–Russell diagram (HRD) as we can detect their photospheric spectrum, and they exhibit spectral features indicative of the presence of a circumstellar disk. These stars are most likely in the final stage of formation. Aims. The aim is to use spectroscopic variability as a diagnostic tool to learn about the physical nature of these massive PMS stars. More specifically, we wish to determine the variability properties of the hot gaseous disks to understand the physical origin of the emission lines, identify dominant physical processes in these disks, and to find out about the presence of an accretion flow and/or jet. Methods. We obtained multiple-epoch (four to five epochs) VLT/X-shooter spectra of six young stars in M17 covering about a decade. Four of these stars are intermediate to massive PMS stars with gaseous disks. Using stacked spectra, we updated the spectral classification and searched for the presence of circumstellar features. With the temporal variance method (TVS), we determined the extent and amplitude of the spectral line variations in velocity space. The double-peaked emission lines in the PMS stars with gaseous disks were used to determine peak-to-peak velocities, V/R ratios, and the radial velocity of the systems. Simultaneous photometric variations were studied using VLT acquisition images. Results. From detailed line identification in the PMS stars with gaseous disks, we identify many (double-peaked) disk features, including a new detection of CO bandhead and CI emission. In three of these stars, we detect significant spectral variability, mainly in lines originating in the circumstellar disk, in a velocity range up to 320 km s−1, which exceeds the rotational velocity of the central sources. The shortest variability timescale is about one day. We also detect long-term (months, years) variability. The ratio of the blue and red peaks in two PMS stars shows a correlation with the peak-to-peak velocity, which might be explained by a spiral-arm structure in the disk. Conclusions. The variable PMS stars lie at similar positions in the HRD, but show significant differences in disk lines and variability. The extent and timescale of the variability differs for each star and line (sets), showing the complexity of the region where the lines are formed. We find indications for an accretion flow, slow disk winds, and/or disk structures in the hot gaseous inner disks. We find no evidence for close companions or strong accretion bursts as the cause of the variability in these PMS stars.