With PU, if you wanted to provide credentials, you'd do something like this:
<nimdir>\bin\pu.exe -u user -p password controller maint_until 'until' 'for' 'comment' 'from'
where time fields are ticks, and one of them is required.
With powershell, you'd need to modify robot.cfg <controller> section to contain key "maint_until" with the value as ticks. You could get it with something like this:
$epoch = get-date -date "01/01/1970"
(new-timespan -start $epoch -end (get-date)).totalseconds -match "\d*"
$until = $matches[0] + time in seconds you want to have the robot in maintenance mode
and then restart the nimbus service.
Here's also my LUA that NAS runs to disable profiles and put robots in maintence mode. It's not the final version but it should how I intend it to work. You'd need to modify it a bit if you wanted to have several remote tests for a server in the same probe
Message is in format "server name;activate" or ";deactivate"
arguments provided by AO profile are: $domain,$origin,$hostname,$message, $nimid
here's the script:
args = split(SCRIPT_ARGUMENT, ",")
info = split(args[4], ";")
target = "/"..args[1].."/"..args[2].."/"..info[1].."/controller"
printf("TARGET: "..target)
maint = pds.create()
pds.putInt(maint, "for", 900)
leave = pds.create()
pds.putInt(leave, "for", 0)
remote_net_args = pds.create()
pds.putString(remote_net_args, "name", "net_connect")
remote_maint_net = pds.create()
if info[2] == "deactivate" then
_, rc = nimbus.request(target, "maint_until", maint)
printf("MAINT MODE RETURN CODE: "..rc)
if info[1] == "profile_name" then
pds.putString(remote_maint_net, "/profiles/profile_name/active", "no")
end
pds.putPDS(remote_net_args, "as_pds", remote_maint_net)
_, rc = nimbus.request("/domain/hub/robot/controller", "probe_config_set", remote_net_args)
printf("DEACTIVATE RC: "..rc)
elseif info[2] == "activate" then
_, rc = nimbus.request(target, "maint_until", leave)
printf("LEAVE MAINT MODE RETURN CODE: "..rc)
if info[1] == "profile_name" then
pds.putString(remote_maint_net, "/profiles/profile_name/active", "yes")
end
pds.putPDS(remote_net_args, "as_pds", remote_maint_net)
_, rc = nimbus.request("/domain/hub/robot/controller", "probe_config_set", remote_net_args)
printf("ACTIVATE RC: "..rc)
end
pds.delete(maint)
pds.delete(leave)
pds.delete(remote_net_args)
pds.delete(remote_maint_net)
-jon