Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Environment Variable From File Dependant On User

Status
Not open for further replies.

SkreeM

IS-IT--Management
Jun 6, 2005
117
GB
Hi All,

I'm working on a project implementing a terminal server for remote access at a customer. they have an application which uses the enviromnet variable $station to run, this is currently and individual 2digit number with a corresponding folder in a network share. this is set as a system variable on all the workstations and must be individual. On the terminal server i want to set the variable to a 3digit number which is automatically assigned as users log on and for the number to be the same if the user logs on again ... I think that i want a CSV file which stores usernames with a corresponding ID, and i need a way of finding what the next avaialble ID is for when a new user logs on.

i have this script
Code:
On Error Resume Next
Dim shell, sysEnv, jsPath, vPath, StationID, sUserpath

StationID = InputBox("Enter The Desired $Station ID For This PC","Set Parameter")

set shell = CreateObject("wscript.shell")
set sysEnv = shell.Environment("SYSTEM")

jsPath = "J:/Jobshop;j:\jobshop\dc;"

vPath = SysEnv("path")


if not instr(Lcase(vPath),"j:\jobshop") then
	vPath = jsPath + vPath

	SysEnv("path") = vPath
End if


If StationID <> "" Then

'	wscript.echo StationID
	SysEnv("$station") = StationID

	Set FSO = CreateObject("scripting.filesystemobject")
	sUserPath = "J:\Jobshop\users\" & StationID & "\"

	If not fso.folderexists(sUserPath) then
		fso.createfolder sUserPath
		'wscript.echo "folder created"
	end if

	if not fso.fileexists("C:\documents and settings\all users\desktop\JOBSHOP.LNK") then
		fso.copyfile "JOBSHOP.LNK", "C:\documents and settings\all users\desktop\JOBSHOP.LNK", TRUE
	End If

	msgbox "Installation Process Complete"

Else
	wscript.echo "Invalid Station Number"
End If

set fso = nothing
set shell = nothing

which i wrote for setting the ID and a couple of other bits on the workstation but need help with the file read/write part.

please help

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top