+ Post New Thread
Results 1 to 11 of 11
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 ...
  1. #1

    glennda's Avatar
    Join Date
    Jun 2009
    Location
    Sussex
    Posts
    7,784
    Thank Post
    272
    Thanked 1,129 Times in 1,025 Posts
    Rep Power
    348

    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?

  2. #2
    bio
    bio is offline
    bio's Avatar
    Join Date
    Apr 2008
    Location
    netherlands
    Posts
    520
    Thank Post
    16
    Thanked 130 Times in 102 Posts
    Rep Power
    37
    Do this from a domain pc where you are domain admin

    the correct syntax =

    Code:
    net user username /DOMAIN /Active:NO
    bio..

  3. 2 Thanks to bio:

    glennda (5th March 2010), Harlquinth (7th July 2010)

  4. #3

    Join Date
    Aug 2005
    Location
    London
    Posts
    3,154
    Thank Post
    114
    Thanked 527 Times in 450 Posts
    Blog Entries
    2
    Rep Power
    123
    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 :-)

  5. Thanks to srochford from:

    glennda (5th March 2010)

  6. #4
    smadison's Avatar
    Join Date
    Sep 2007
    Location
    UK
    Posts
    100
    Thank Post
    2
    Thanked 30 Times in 25 Posts
    Rep Power
    19
    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".

  7. #5

    glennda's Avatar
    Join Date
    Jun 2009
    Location
    Sussex
    Posts
    7,784
    Thank Post
    272
    Thanked 1,129 Times in 1,025 Posts
    Rep Power
    348
    Quote Originally Posted by smadison View Post
    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".
    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.

    I knew i was doing something stupid ill give it a go... first to set up assembly!!

  8. #6

    mac_shinobi's Avatar
    Join Date
    Aug 2005
    Posts
    9,673
    Thank Post
    3,205
    Thanked 1,029 Times in 954 Posts
    Rep Power
    361
    Quote Originally Posted by srochford View Post
    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 :-)
    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 ?

    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 ??

  9. #7

    glennda's Avatar
    Join Date
    Jun 2009
    Location
    Sussex
    Posts
    7,784
    Thank Post
    272
    Thanked 1,129 Times in 1,025 Posts
    Rep Power
    348
    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!

    Toby

  10. #8

    mac_shinobi's Avatar
    Join Date
    Aug 2005
    Posts
    9,673
    Thank Post
    3,205
    Thanked 1,029 Times in 954 Posts
    Rep Power
    361
    Quote Originally Posted by glennda View Post
    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!

    Toby
    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

    HOW TO: Limit User Logon Time in a Domain in Windows Server 2003

  11. #9

    glennda's Avatar
    Join Date
    Jun 2009
    Location
    Sussex
    Posts
    7,784
    Thank Post
    272
    Thanked 1,129 Times in 1,025 Posts
    Rep Power
    348
    Quote Originally Posted by mac_shinobi View Post
    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

    HOW TO: Limit User Logon Time in a Domain in Windows Server 2003
    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

  12. #10

    mac_shinobi's Avatar
    Join Date
    Aug 2005
    Posts
    9,673
    Thank Post
    3,205
    Thanked 1,029 Times in 954 Posts
    Rep Power
    361
    Quote Originally Posted by glennda View Post
    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!

    Toby
    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.

    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.

  13. #11

    Join Date
    Aug 2005
    Location
    Birmingham
    Posts
    167
    Thank Post
    54
    Thanked 17 Times in 16 Posts
    Rep Power
    20
    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.

SHARE:
+ Post New Thread

Similar Threads

  1. esx command line help
    By ful56_uk in forum Thin Client and Virtual Machines
    Replies: 6
    Last Post: 17th February 2010, 05:04 PM
  2. Disabling GW account?
    By googlemad in forum Netware
    Replies: 1
    Last Post: 22nd August 2008, 12:27 PM
  3. Disabling the remote shutdown command.
    By IT_Man_Dan in forum Windows
    Replies: 15
    Last Post: 15th November 2007, 01:31 PM
  4. Replies: 8
    Last Post: 20th February 2007, 07:00 PM
  5. Command LIne
    By wesleyw in forum Windows
    Replies: 4
    Last Post: 12th October 2006, 11:10 AM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •