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