The IceCube collaboration recently reported the potential detection of two cascade neutrino events in the energy range 1-10 PeV. We study the possibility that these PeV neutrinos are produced by gamma-ray bursts (GRBs), paying special attention to the contribution by untriggered GRBs that elude detection due to their low photon flux. Based on the luminosity function, rate distribution with redshift and spectral properties of GRBs, we generate, using Monte-Carlo simulation, a GRB sample that reproduce the observed fluence distribution of Fermi/GBM GRBs and an accompanying sample of untriggered GRBs simultaneously. The neutrino flux of every individual GRBs is calculated in the standard internal shock scenario, so that the accumulative flux of the whole samples can be obtained. We find that the neutrino flux in PeV energies produced by untriggered GRBs is about 2 times higher than that produced by the triggered ones. Considering the existing IceCube limit on the neutrino flux of triggered GRBs, we find that the total flux of triggered and untriggered GRBs can reach at most a level of ~10^-9 GeV cm^-2 s^-1 sr^-1, which is insufficient to account for the reported two PeV neutrinos. Possible contributions to diffuse neutrinos by low-luminosity GRBs and the earliest population of GRBs are also discussed.