Page 1 of 1

afcmd - setting nimby errors

Posted: Tue May 28, 2019 2:16 pm
by belegdae
Hello,

I'm trying to configure a local script (windows) to set nimby when users log in, and clear when log off.

If I use keeper or the webui I can toggle Nimby fine, but running afcmd I get an error:

Code: Select all

TJSONBIN[149]
{"info":{"kind":"error","text":"Action node(s) not found."}}
AfCmd::msgOut: TJSONBIN[72]
Running on windows, and command is:

Code: Select all

_afcmd.cmd rNIMBY %computername%
Using afcmd to create users works fine.

Any ideas? Thanks!

Re: afcmd - setting nimby errors

Posted: Tue May 28, 2019 2:53 pm
by timurhai
Hi.
Try to enter host name by hand, some host that is definitely exists.

Re: afcmd - setting nimby errors

Posted: Tue May 28, 2019 2:57 pm
by belegdae
Aah, found the problem!
Afanasy appears to convert all hostnames to lower case.
If a machine has a hostname of "ABCDE" then it needs to command to be "abdce" first.

If this is by design, could afcmd convert hostnames to lower as a feature request? I'll fix in our script for now

Thanks for the help!

Re: afcmd - setting nimby errors

Posted: Tue May 28, 2019 3:00 pm
by timurhai
Yes, afcmd should do the same as afserver.
Will be implemented!

Re: afcmd - setting nimby errors

Posted: Tue May 28, 2019 3:26 pm
by belegdae
That's great, thank you!

For anyone that might need it, here's a little batch that converts the hostname to lower before calling afcmd:

Code: Select all

@ECHO OFF
SETLOCAL ENABLEDELAYEDEXPANSION

CALL :LCase COMPUTERNAME _HOSTNAME_LOWER
CALL _afcmd.cmd rNIMBY %_HOSTNAME_LOWER%

ENDLOCAL
GOTO:EOF

:LCase
SET _LCase=a b c d e f g h i j k l m n o p q r s t u v w x y z
SET _Lib_UCase_Tmp=!%1!
FOR %%Z IN (%_LCase%) DO SET _Lib_UCase_Tmp=!_Lib_UCase_Tmp:%%Z=%%Z!
SET %2=%_Lib_UCase_Tmp%
GOTO:EOF

Re: afcmd - setting nimby errors

Posted: Wed Feb 26, 2020 4:51 pm
by timurhai
Hi!
It is implemented in code (GitHub master).
Will be available in the next releases.