Discussion Locked

VBScript

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Hi,

I am looking for a VBScript to create userIDs, change properties, and add/remove from groups.
And create NT groups.

This all on NT Workstations in a workgroup on their own.

I want to use this during an unattend setup of remote stations,
I tried it with a command file filled with net use commands, but this keeps on rebooting on me.

Thanks in advance,

Eduard de Vries
edevries@footlocker.com

5 replies

by gregpip

You could use a utility called addusers.exe that is found with the Windows NT Resource Kit. A text file can be created that contains userIDs and groups that the utility reads from when executed.

Good Luck

by edrox

Sorry Greg,

I tried this but I can't set properties like no password required, etc that way.

Thanks for helping

Eduard

by mike_haslam

Pasted below is the script to read a list of users out of the SAM using the ADSI interface and dump them into a file, so you could customise that. you'd need to customise it so that Domain is set to the workstation name, but get that from the data file.

Copy and paste this into Notepad to reformat.

Const ForReading = 1, ForWriting = 2, ForAppending = 8

DomainName = "MYDOMAIN"
Set WSHNetwork = WScript.CreateObject("WScript.Network")
Set Shell = WScript.CreateObject("WScript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")
RunFolder = "\\server\folder"

Set Domain = GetObject("WinNT://" & DomainName)

For each Object in Domain
if Object.Class = "User" then
ret = WriteOutput(RunFolder & "USERNAMES.txt", Object.name & " " & Object.FullName & " " & Object.Description)
end if
Next

msgbox "Done"

'********************************************************************
'* General Purpose Result File Output *
'********************************************************************
function WriteOutput (File, Data)
dim f, rtn

set f = fso.openTextFile(File, forAppending, true)
rtn = f.writeline (Data)
f.close
end function

This discussion is closed to new replies.