declare @server_performer_id int, @wake_action_id int, @ping_action_id int
select @server_performer_id = PerformerId from PowerActionPerformer where PerformerCode = 'NETWORK_RESURRECTOR_SERVER'
select @wake_action_id = PowerActionId from PowerAction where PowerActionCode = 'WAKE'
select @ping_action_id = PowerActionId from PowerAction where PowerActionCode = 'PING'

-- insert WAKE configuration for all machine that don't have it
insert into PowerActionConfiguration (MachineId, PowerActionId, PerformerId)
select m.MachineId, @wake_action_id, @server_performer_id
from Machine m
left join PowerActionConfiguration c on m.MachineId = c.MachineId and c.PowerActionId = @wake_action_id
where c.ConfigurationId is null

-- insert PING configuration for all machine that don't have it
insert into PowerActionConfiguration (MachineId, PowerActionId, PerformerId)
select m.MachineId, @ping_action_id, @server_performer_id
from Machine m
left join PowerActionConfiguration c on m.MachineId = c.MachineId and c.PowerActionId = @ping_action_id
where c.ConfigurationId is null
