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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HELP! Need to automate a logon based on a variable!

Status
Not open for further replies.
Jun 7, 2002
4
0
0
US
Here is the problem - I need to be able to to turn on a machine, upon boot a variable will be set (i.e. let's say a text.txt file is created that includes a line that states what kind of functionality this workstation will have).

example - Text.txt (contents of file is 1 line "HR"

this file says this is a human resource machine, therfore it should auto-logon with the "HR" logon ID.

I got the autologon part of the VBscript down, the problem is I don't know how to tell it to read the file, and, based on the contents proceed to call another VBscript that will create an autologon for the HR ID upon reboot.

And one other thing - if upon checking the variable, if it finds that it is something that doesn't have a script associated to it, it must call a default script.

Make sense?

Please help!
 
you need to create a FileSystemObject to read a file in Vbscript. After you create the Object and open the file you can do as you will with it. Microsoft has the best details on the steps.

page down to reading files and it will give you examples.
if you need help with getting it started I can help out.

hope that gets you started.
I may not get it the 1st or 2nd time,
but how sweet that 15th time can be.
 
Thanks for the start, I read it .. and have a question. It looks like VBscript would create the text file before it reads it? The situation is that another program will create this text file (test.txt) and populate it with a certain variable that I would need the VBscript to read and act accordingly.
example:

test.txt (already created by another app)..contains "function=human_resources"

Now I would need a script to read the variable <function>.

<VBScript>
if function=&quot;human_resources&quot; then .run <another vbscript>

I hopes this helps with the confusion - I am not a programmer, just the person designated to find the best way to do this without pulling all my hair out.

thanks..
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top