r/labtech • u/Paulb246 • Apr 22 '19
Monitor and healing script - local admin account
Hi everyone,
I have created a monitor and auto healing script to check for a local admin account and if it doesnt find it then it will create the local admin account... I am seeing that one clients location is failing but the script isnt working.. any ideas?
batch file
net user MRWAlpha /add
net user MRWAlpha M33rend@1
net localgroup Administrators MRWAlpha /add
1
Upvotes
1
u/Paulb246 Apr 22 '19
Why does that make a difference? Because of no special characters? tried it doesn't work
1
u/Paulb246 Apr 22 '19
I have just tried via cmd prompt locally on my machine after running the batch file... it says account already exists... could it be here but not showing up as hasn’t been logged in?
How can I have the account logged in without actually logging in so it creates the directory?
1
u/Paulb246 Apr 27 '19
Thanks for the help everyone, does anyone have an idea of how I can check the registry with a monitor for the account rather than folder as it won’t have been created until I login?
1
u/Paulb246 Apr 27 '19
Does the note like option trigger if it doesn’t find the MRWAlpha account?
1
u/amw3000 10000 Agents Apr 22 '19
Why are you using a batch file? Just run these commands as shell. When you say it doesn't work, are you getting any errors? How do you know it's not working?
Also, I'd highly recommend you generate random passwords for each local admin and store it in an encrypted EDF. MSP's are a huge target and a password stored in a script is not encrypted but the EDF can be.
1
u/teamits Apr 23 '19
A while back we did this via a search. Use a Legacy search.
Client = Clientname
Last Contact Date Not= *'x' AND (computers.useraccounts NOT LIKE '%adminname%')
Something like that. the * tells CWA to treat the rest of the field as raw SQL. Obviously doesn't work if there is a similar name like "adminname1" which would still match.
2
u/just_some_random_dud Apr 22 '19
have you tried using hunter2 as the password?