Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Will pay for copies of Visual FoxPro 3 by Siegel
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00144767
Message ID:
00145711
Views:
36
>Do me a favor John.... send me that question again. I had some problems with my email and lost most of my inbox.
>
>Thanks...
>
>
>>Hey John, tell us how you REALLY feel! This author must be your brother-in-law!< VBG > I don't suppose you ever got around to checking out that WSH problem (wscript.----)?

Here's the sample I pulled from the web:
' This Script adds users from a text file and set up a
' Default profile path, Home directory etc, Then it shares
' the home directory and assigns the appropriate access rights for the home directory.
' This script is kinda sloppy but it worked for me.

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

Set FileSys = CreateObject("Scripting.FileSystemObject")
Set TxtFile = FileSys.OpenTextFile("c:\Userlist.txt", ForReading, TristateFalse)
Set Network = WScript.CreateObject("WScript.Network")
Set Shell = WScript.CreateObject("WScript.Shell")
Set DomainObj = GetObject("WinNT://Domain")
Set HomeServerObj = GetObject("WinNT://Domain/Server/lanmanserver")
	
LogonScript = "default.bat"
InitialPassword = "newuser"
UserHomeUpperDir = "\\Server\users"
	
WshNetwork.MapNetworkDrive "x:", "\\Server\users"
WshNetwork.MapNetworkDrive "Y:", "\\Server\Profiles\"

		If TxtFile.AtEndOfLine <> True then UserNameVar = TxtFile.ReadLine
		If TxtFile.AtEndOfLine <> True then FirstNameVar = TxtFile.ReadLine
		If TxtFile.AtEndOfLine <> True then LastNameVar = TxtFile.ReadLine
		If TxtFile.AtEndOfLine <> True then GroupVar = TxtFile.ReadLine

Do While TxtFile.AtEndOfLine <> True

	UserHome = UserHomeUpperDir & "\" & UserNameVar

	Set NewUser = Domain.Create("user",UserNameVar)
	NewUser.FullName = FirstNameVar & " " & LastNameVar & " " & MiddleInit
	NewUser.HomeDirectory = UserHome
	NewUser.Profile = "\\Server\Share\" & UserNameVar
	NewUser.LoginScript = LogonScript
	NewUser.Description = "Description"

	NewUser.SetInfo
	NewUser.SetPassword(InitialPassword)
	Set NewUser = Nothing
	
	FileSys.CreateFolder("x:\" & UserNameVar)
	FileSys.CreateFolder("Y:\" & UserNameVar)
	
	UserShare = UserNameVar & "$"

	set newshare = HomeServerObj.create("fileshare", UserNameVar & "$")
	newshare.path="E:\Users\" & UserNameVar
	newshare.setinfo
	
		Do While GroupVar <> "NextUser"
			Set GroupObj = GetObject("WinNT://domain/" & GroupVar, group)
			GroupObj.add("WinNT://domain/" & UserNameVar)
			GroupObj.setinfo
			GroupVar = TxtFile.ReadLine
		Loop
	
	Shell.run "cacls x:\" & UserNameVar & " /t /g " & UserNameVar & ":F",1,true
	Shell.run "cacls x:\" & UserNameVar & " /e /t /g administrator:F",1,true
	
	If TxtFile.AtEndOfLine <> True then UserNameVar = TxtFile.ReadLine
	If TxtFile.AtEndOfLine <> True then FirstNameVar = TxtFile.ReadLine
	If TxtFile.AtEndOfLine <> True then LastNameVar = TxtFile.ReadLine
	If TxtFile.AtEndOfLine <> True then GroupVar = TxtFile.ReadLine
		
loop
	
Txtfile.close
WScript.echo "All Done"
John Harvey
Shelbynet.com

"I'm addicted to placebos. I could quit, but it wouldn't matter." Stephen Wright
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform