Require strong authentication for unmanaged devices script

var dmod = module('Device');
var device = dmod.getDevice();
if(!device.isManaged){
      policy.RequiredLevel = 2;
}