how to create batch files in XP pro for activating/deactivating an user

  • Thread starter Thread starter favor
  • Start date Start date
F

favor

hi all,

I am new to batch files. I want to create a batch file in Win XP pro
for autometically activating and deactivating an user account at
scheduled days in the week. The program needs to run invisibly. How to
do I do that?

Thanks,
favor
 
favor said:
hi all,

I am new to batch files. I want to create a batch file in Win XP pro
for autometically activating and deactivating an user account at
scheduled days in the week. The program needs to run invisibly. How to
do I do that?

Thanks,
favor

Google Is Your Friend. Use the search term, "create batch file Windows
XP" and get about 247,000 links. Lots of the ones on the first page
look like they would be useful to you.

Malke
 
favor said:
hi all,

I am new to batch files. I want to create a batch file in Win XP pro
for autometically activating and deactivating an user account at
scheduled days in the week. The program needs to run invisibly. How to
do I do that?
Hi

Below are two VBScripts (.vbs), one for disable user, and one for
enable user.

In the scheduler, run them like this:

wscript.exe DisableUser.vbs
wscript.exe EnableUser.vbs


DisableUser.vbs:

'--------------------8<----------------------
sUser = "SomeUser"

Set oWshNet = CreateObject("WScript.Network")

Set oUser = GetObject("WinNT://" _
& oWshNet.ComputerName & "/" & sUser & ",user")

oUser.AccountDisabled = True
oUser.SetInfo
'--------------------8<----------------------


EnableUser.vbs:

'--------------------8<----------------------
sUser = "SomeUser"

Set oWshNet = CreateObject("WScript.Network")

Set oUser = GetObject("WinNT://" _
& oWshNet.ComputerName & "/" & sUser & ",user")

oUser.AccountDisabled = False
oUser.SetInfo
'--------------------8<----------------------


WSH 5.6 documentation (local help file) can be downloaded
from here if you haven't got it already:

http://msdn.microsoft.com/downloads/list/webdev.asp
 
Hi Bakken,
I am not familiar with Windows scripting. It will great if you can
give me a step by step procedure to go about with the code that you
had sent me. Thank you,
Favor
 
favor said:
Hi Bakken,
I am not familiar with Windows scripting. It will great if you can
give me a step by step procedure to go about with the code that you
had sent me. Thank you,
Hi

Here are some Windows Script Host (WSH) Web introductions that should
get you going:

WSH
http://cis.stvincent.edu/wsh/index.html

Introduction to Windows Scripting
http://www.winguides.com/article.php?id=2

NT Gains Scripting Muscle
An introduction to Windows Script Host by Bob Wells.
http://www.winnetmag.com/Articles/Index.cfm?ArticleID=3026

Scripting 101
A 4 part series on how to create and structure WSH scripts by Bob Wells
http://www.winnetmag.com/Articles/Index.cfm?ArticleID=5410
http://www.winnetmag.com/Articles/Index.cfm?ArticleID=5505
http://www.winnetmag.com/Articles/Index.cfm?ArticleID=5683
http://www.winnetmag.com/Articles/Index.cfm?ArticleID=7112

VBScript Primer
http://www.microsoft.com/resources/...erver/scriptguide/en-us/sas_vbs_overview.mspx


Also note the links to Scriptomatic/ADSI Scriptomatic/Tweakomatic Tool
under "Scripting Tools and Utilities" here:
http://www.microsoft.com/technet/community/scriptcenter/default.mspx
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top