Avatar of wantabe2
wantabe2
Flag for United States of America asked on

VBSCRIP Issue

I have the follwoing code in my logon script & it is failing on this line:

NET localgroup Administrators /add "mydomain\User_Admins"

I'm trying to add the User_Admins group to the local computer in the user settings when the user logs in. This is a Windows 2008 domain using .vbs as the login script. Any suggestions?
VB ScriptActive DirectoryWindows Server 2008

Avatar of undefined
Last Comment
Darren Collins

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Mike Kline

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
josika

Is the user the script is running under an administrator on the machine where it is failing?
Serge Fournier

the logon script policy can make a logon script run as "system" or the logged user
(two different policy)

you have to run your script twice in the GPO
and then in your script, add a condition when the netlogon user name is "system" it mean it's run before the user logon, with admin rights
and ELSE run the rest of the script with normal user rights<

this way you can do stuff with admin right (aka system user is logged on)


josika

I would personally take Mike's route above and use Restricted Groups via GPO.  Much easier and it will remove all unwanted user accounts from the local Administrators group (sort of like a baseline).
Your help has saved me hundreds of hours of internet surfing.
fblack61
SOLUTION
Darren Collins

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question