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

Need name of workstation logging on 3

Status
Not open for further replies.

DTracy

Programmer
Feb 20, 2002
844
US
I have a department OU that has two different locations. Location_1 has some printers, and Location_2 has some other printers. When User_1 logs in on a Location_1 workstation he/she needs to be connected to Printers_1. But if User_1 logs in on Location_2 workstation then he/she needs to connect to Printers_2.

What I think I need to do is determine the name of the workstation when the login is made so that I can connect the correct printers.

Ideas?

Thanks,
David.
 
determine the name of the workstation
You may use the WshNetwork.ComputerName property.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
...and if you want to see the OU this workstation is in you can try:

Code:
Option Explicit

Dim objADSysInfo : Set objADSysInfo = CreateObject("ADSystemInfo")
WScript.Echo objADSysInfo.ComputerName

--------------------------------------------------------------------------------
dm4ever
My philosophy: K.I.S.S - Keep It Simple Stupid
 
Thanks for the fast responses. I truly appreciate your valuable time and resources to share this information.

And I'm like "Duh" when I read PHV's response, geese it was right in front of me. Can't see the forest for the trees.

Thanks again and best regards,
David.
 
Some other food for thought.

faq329-5908

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.
 
Thanks Mark for the look-see, I may use something out of there later on.

I have a script up and running but it is a little slow, takes about five or six seconds to connect up. I haven't used VB for ever and ever, and I can't remember all the commands and statements. I read some stuff from the MSDN over the weekend and that helped.

Does anyone know if VB Script has an equivalant of Begin Sequence/End Sequence/Break/Recover without using an infinite do/loop/exit do?

Again, thanks for all the help.
Best regards,
David.
 
What are you trying to do? Might help with answering your latest query. Be sure to check out my main login script faq as well. faq329-5798



I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.
 
Ok, here's the story. I've been mapping the users drives via a batch file for a long time. I decided it was time to update the process to VB and at the same time do the printers as well. It's been years since I've written in VB, been writing in xBase and a little C. Anyway, in order to speed up the login process I decided to handle users in one part of the code and printers in the other--much like you do in your program. I use a Select Case/End Select to determine which workstation is being logged in ie: Case "MyWorkstation" and proceed to map printers accordingly. I am used to writing this type of code using:

Begin Sequence
Select Case cComputerName
Case "MyWorkstation"
' Map to \\Server\myprinter
.
.
Break
Case ...

End Select
End Sequence

With the Select Case inside the Sequence, when the Break is read the program jumps to the next statement after End Sequence. And so on...

Anyway, with 10 - 15 workstations there is a significant change in the execution time when all the remaining Case statements are bypassed. So, I just used Do/Loop/Exit Do to simulate the Sequence.

That's all there is to it. No big deal. Once I get used to the VB script again I won't have these problems.

Thanks for your help, it is appreciated.
David.
 
Aside from computer names, what else is different to determine which printers need to be installed? Can you use logonserver? How about IP address?

If you wrap your Select Case in a Sub you could use Exit Sub to break execution.





I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.
 
I took another look at logonserver and as our domain is rather small - we currently have three domain controllers, one of which is dedicated to login only - I don't think determination of logonserver is necessary. We use DHCP for most of our workstations, but oWshNetwork.ComputerName seems to be the easiest way to identify the workstation.

Here's the thing:

OU = Sheriff's Department
Two global security groups - Dispatch and Jail.

Most detention officers are also dispatchers so when they login on a Jail computer they need Jail printers, and when logged in on Dispatch computers they need Dispatch printers. Same people, same department, different workstations and printers.

Also, there is a sheriff's substation in the lower end of the county that field deputies use, so that has to be handled as well.

Thanks for your help and input Mark, it means a great deal.

David.
 
Seems to me that what you need most is to setup all the printers for everyone but then specify the default printer at login.

If you have a naming convention for the computers you could easily limit the number of choices in your select case by just working with the part of the machine name that identifies the section the computer is in rather than using the entire machine name.

You can of course also use a comma to test for multiple names, I just frown on using computer names in the script because you will need to modify the script every time you add or remove a workstation. That is not a very good idea when it can be accomplished other ways.

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.
 
Ok, I have a naming convention where the first two to four chars of the name determine the department ( OU ). But I already know which OU the user is in (was tested for), all I need is specifically at which workstation they are setting.

The reason I don't install all available printers and then select the default is it causes confusion about which printer to use. When you flood the list with all available printers and fax machines, the user doesn't have a clue, especially when half of the hardware is in a different building.

What I was truly thinking about was later on, to create a database with all this information in it and when a user logs in, look up the user/machine and apply settings accordingly.
This would make changes much simpler.


Thanks again for all your help Mark, it is appreciated.
David.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top