Hi Lisa!
This _should_ run, but don't blame me if it doesn't ;)
As said, I don't have NT at home to test it. It's a quick hack with little
errorcheck. Hope it works.
(...)
Quote:
> I wish I had your skills as a programmer.
(...)
Oh... thanks for the compliment, but I'm only a network admin who tries to
keep his work as easy as possible.
I'm the laziest person I know ;)
Cheers
Dennis
---< snip >---
<?xml version="1.0" encoding="ISO-8859-1"?>
<job id="NetUser">
<script language="VBScript">
<![CDATA[
Function VBInputBox(strLabel)
VBInputBox = InputBox(strLabel, "Input required")
End Function
]]>
</script>
<script language="JScript">
<![CDATA[
var objShell = WScript.CreateObject("WScript.Shell");
/* Don't know if the next line works;
if not, give the full path and maybe a leading "%comspec% /c" */
objShell.Run("net user > c:\\netuser.txt", 0);
var strUser = VBInputBox("Change password for all users\nbeginning
with...");
var strPassword = VBInputBox("Change password for all users\nbeginning with
" + strUser + " to...");
var objFSO = WScript.CreateObject("Scripting.FileSystemObject");
var netuser = objFSO.OpenTextFile("c:\\netuser.txt");
while(!netuser.AtEndOfStream){
var strReadLine = netuser.ReadLine();
var RegEx = new RegExp("(" + strUser + "\\w*)\\s+(" + strUser +
"\\w*)\\s+(" + strUser + "\\w*)","i");
RegEx.exec(strReadLine);
/* A problem here. I don't know how to reset RegExp.$1.
The script should run anyway, but some users will have
their password changed more than once (time consuming) */
if(RegExp.$1 != ""){
/* Don't know if the next line works;
if not, give the full path to net.exe
and maybe a leading "%comspec% /c".
And you will have to change the syntax since I don't know it ;) */
objShell.Run("net user " + RegExp.$1 + " " + strPassword, 0)
}
if(RegExp.$2 !=
// see above comment
objShell.Run("net user " + RegExp.$2 + " " + strPassword, 0)
}
if(RegExp.$3 !=
{
// see above comment
objShell.Run("net user " + RegExp.$3 + " " + strPassword, 0)
}
Quote:
}
]]>
</script>
</job>
---< snip >---