Windows Thread, Enabling/disabling account from Command line in Technical; I am looking into ways to try and reduce the load for this stupid controlled assessment coursework thing where they ...
4th March 2010, 10:18 PM #1
Enabling/disabling account from Command line
I am looking into ways to try and reduce the load for this stupid controlled assessment coursework thing where they can have nothing apart from word or something like that.
I am trying to set up a way that i can batch file for each class so we can schedule a job to enable/disable the accounts. I am trying to do this via Net user but its a long time since i used it and i think i have the syntax wrong although i am reading it off the microsoft website!
i am trying
net user %username% /domain.local /active:yes obviously substituting %username% with the kids username
am i just being really stupid or is not?
5th March 2010, 07:27 AM #2
Do this from a domain pc where you are domain admin
the correct syntax =
net user username /DOMAIN /Active:NO
2 Thanks to bio:
glennda (5th March 2010), Harlquinth (7th July 2010)
5th March 2010, 08:03 AM #3
key thing which isn't always obvious is that you don't put the name of the domain -ie it's just "/domain" not "/name.of.my.domain"
Excel is your friend here - get a list of usernames in column A and then in B1 put:
="net user " & A1 & " /domain /active:no"
fill down, copy and paste the contents of column B into notepad save as a batch file and job done.
When you want to reverse it, just put "/active:yes" in the formula and job done :-)
Thanks to srochford from:
5th March 2010, 08:11 AM #4
We have a profile where they only have access to MS Office and time restrict the accounts and appears to work here. We call the profile "The Doghouse".
5th March 2010, 08:24 AM #5
This is how i have set it up but the i cannot set it up via AD for time restrictions as we have a 2 week timetable and would mean changing it each week which i can't be bothered - was going to run the script a couple of mins before the lesson then the opersite after each lesson.
Originally Posted by smadison
I knew i was doing something stupid ill give it a go... first to set up assembly!!
5th March 2010, 08:28 AM #6
or use your favourite scripting language ( vbscript ) and save that as a csv and you can use vbscript to go through each value of the csv file and execute each of those as commands ?
Originally Posted by srochford
Maybe have a boolean type variable that you can set to yes or no and you just have an input box and either type yes or no for the active part of the command ??
5th March 2010, 10:08 AM #7
I would do it like that but i am trying to set it up so that i don't have to do anything! i am just going to set up class scripts that enable the account a min before the beginning of the lesson then disable them again at the end of the lesson also im going to try and experiment with adding them into my Exam internet group and then removing them from it so i have nothing to remember to do as i am not very good at remembering!
5th March 2010, 10:11 AM #8
just thought - can't you do this in active directory assuming you have the OU's setup correctly you could multi select the users and either disable them enable them or I think there is a section somewhere that you can set times of when they can log in and are allowed to use the account
Originally Posted by glennda
HOW TO: Limit User Logon Time in a Domain in Windows Server 2003
5th March 2010, 10:14 AM #9
problem with that is it is over a two week period so would require changing on a friday for the next week with scheduled tasks i can get them set up now for the next 2 months rather then keep having to change. the teachers have given me a timetable of when the students will be allowed internet etc. but the select all enable/disable still means i have to be at my pc at the time. only downside of the scheduled tasks is if server goes down but then they dids wouldnt be able to access work anyway as i am going to do it from the server server with exam shares on
Originally Posted by mac_shinobi
5th March 2010, 10:18 AM #10
Not tried it but you might be able to make the one script toggle the yes or no option so if they are set to no then it will toggle it to yes and visa versa so you dont have to specify the option.
Originally Posted by glennda
Would be nice if I could have a look into this later on - good time to setup a server 2003 vm and have a prat about.
5th March 2010, 10:33 AM #11
- Rep Power
I've been using the dsmod user command in a .bat which I then schedule to run on a DC, one .bat file to enable the accounts and another to disable them.
By ful56_uk in forum Thin Client and Virtual Machines
Last Post: 17th February 2010, 05:04 PM
By googlemad in forum Netware
Last Post: 22nd August 2008, 12:27 PM
By IT_Man_Dan in forum Windows
Last Post: 15th November 2007, 01:31 PM
Last Post: 20th February 2007, 07:00 PM
By wesleyw in forum Windows
Last Post: 12th October 2006, 11:10 AM
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)