Students caught "sexting" or cyber-bullying at school will be asked to reveal the offending content or face having their device seized and given to police.
New digital guidelines for schools stipulate that if information stored on a student's phone is harmful to their peers and their learning environment, teachers have the right to ask to see the content, delete it, or take the device away.
The rules apply even if the items on the phone - or tablet or computer - are from outside school, for example a video of a fight at the weekend, or naked photos of a former girlfriend.
"The focus now is whether there is an effect at the school, not when an incident happened. It if disrupts school, we are concerned about it," said Patrick Walsh, chairman of the Online Safety Advisory Group, which developed the guidelines.
The guidelines, issued this month, were developed by principals, police, legal advisers, Netsafe and the Ministry of Education after an update to the Education Act left schools concerned over their legal rights.
Guidelines on search and seizure issued last year caused further confusion, as teachers did not know what applied in the digital realm.
Mr Walsh said the aim was to give principals and teachers the information to act confidently, without breaching privacy.
There are some strict caveats in the guide - teachers cannot search through a device or a student's online accounts, ask for passwords or force a student to download content from other devices.
But if a student is believed to have breached the law, the school can seize the device involved and take it to the police.
"For example if someone took a photo of a person who is naked, and they're under 16, then that could be considered child pornography. Many students don't realise that," Mr Walsh said.
He said while that might sound punitive, in some cases it was necessary.
"We have tried to take an educative approach but there is a hard-core group of students who just thumb their nose at it."
Netsafe programme leader Neil Melhuish said it had been hard for some schools to get their heads around digital safety - particularly from the point of view of their students.
"Kids don't see a distinction between offline and online - but searching a bag for a knife and looking at an online chat for something harmful are quite different," he said. "It's not a tangible thing."
Mr Melhuish said Netsafe was urging teachers to focus on the behaviour and relationships behind the technology, and to ask for help with the technical side if they needed it.
"We want to let schools know they're not alone."
Children's Commissioner Russell Wills said creating a prevention plan was just as important as knowing how to deal with incidents.
"Like bullying in general, it's about creating an environment of responsibility," he said.
"We need to teach good digital citizenship."
Parents and the wider community had to become involved as well, he said.
Youngsters learn to be savvy on internet
By the time children leave Henderson Valley primary, they're likely better equipped to deal with the mires of the internet than most adults.
Students as young as 5 are taught about online safety, privacy and their "digital footprint" as teachers go about their daily classroom business.
Teacher Mike Chatfield, whose Year 4 class are all equipped with iPads, says the youngest children learn through immersion, while the older students have specific programmes.
"At the beginning, online safety is modelled in everything the teacher does. We find activities to bring them in and develop understanding," he says.
This may be as simple as choosing not to watch a YouTube video because the teacher hasn't viewed it to make sure it's safe - which the teacher would voice aloud to students.
Once students hit Year 3, they sign a user agreement and begin to have some more focused classes, in the hope that by the time they get a smartphone or their own social media accounts they will be responsible "digital citizens".
Internet behaviour is brought back to what's appropriate in the real world. Students are taught to comment positively on photos or videos as part of brainstorming during sessions.
Mr Chatfield says topics include what it even means to be online, what happens when you write a post, and who it's safe to talk to.
"We relate it back to real life - if someone in a car pulled up beside you and wanted to talk, you would keep moving. It's the same thing.
"It's probably something many adults could do with a lesson on."