Hello
i want script to delete all hotspot disabled users and their scripts with same hotspot name
ex:
i have disabled user with name 23456 and it has script with same name 23456
i want to delete them
i used below script but it delete all scripts
Fetch all disabled hotspot users
:foreach user in=[/ip hotspot user find disabled=yes] do={
:local username [/ip hotspot user get $user name]
Remove the user
/ip hotspot user remove $user
:log info ("Removed disabled hotspot user: " . $username)
Remove associated scripts
:foreach script in=[/system script find] do={
:local scriptName [/system script get $script name]
:if ([:find $scriptName $username] != 0) do={
/system script remove $script
:log info ("Removed associated script: " . $scriptName)
}
}
}
thanks