setting default printer based on sorkstation location for romaming profile 
Author Message
 setting default printer based on sorkstation location for romaming profile

i need to be able to set the default printer based on the location of the
workstation. in a lab with 26 computers i want half to print to printer a
and half to print to printer b. i also want to be able to use roaming
profiles

how can i do this using wsh?

mike



Wed, 13 Jun 2001 03:00:00 GMT  
 setting default printer based on sorkstation location for romaming profile

If you are using TCP/IP as your primary network protocol you could parse an identifying octet of the IP address and map your printers accordingly. Getting the IP address can be done a couple of ways.
    a.. By using an external control like ActiveExec or AspExec to ping itself and parsing the output.
    b.. Using the MsWinsck control to parse the IP address.
I have found that the first method was more reliable for me. For some reason MsWinsck doesn't seem to work well with some configurations. It may work perfectly in your environment.

You can get ActiveExec at http://www.activitysoft.com or at my site http://cwashington.netreach.net

You can get AspExec at http://www.serverobjects.com

MsWinsck comes with VB6. You can find it on Microsoft's site but I don't have the URL handy.

Clarence
Check it out
http://cwashington.netreach.net

Win32 bit scripting. Everything you need to get up and running,
A script repository containing almost 100 sample scripts,
downloads, reference files, and technical support via an
online discussion forum.

i need to be able to set the default printer based on the location of the
workstation. in a lab with 26 computers i want half to print to printer a
and half to print to printer b. i also want to be able to use roaming
profiles

how can i do this using wsh?

mike



Wed, 13 Jun 2001 03:00:00 GMT  
 setting default printer based on sorkstation location for romaming profile

    thanks for the reply. we are using dhcp to assign addresses for the
workstations with 30 day leases. I should also mention that I am new at this
so could use some pointers on best practices for learning wsh programming.
none of the books are out yet.

    your site has been helpful but I am what learning path I should follow
so the learning is incremental.

    mike



Thu, 14 Jun 2001 03:00:00 GMT  
 setting default printer based on sorkstation location for romaming profile

Have you been to Ian's site? http://wsh.glazier.co.nz Lots of useful info there too.

Clarence
Check it out
http://cwashington.netreach.net

Win32 bit scripting. Everything you need to get up and running,
A script repository containing almost 100 sample scripts,
downloads, reference files, and technical support via an
online discussion forum.

(Pursuant to US Code, Title 47, Chapter 5, Subchapter II, 227, any and all
unsolicited commercial E-mail sent to this address is subject to a download
and archival fee in the amount of $1000 US.  E-mailing denotes acceptance of
these terms.)

    thanks for the reply. we are using dhcp to assign addresses for the
workstations with 30 day leases. I should also mention that I am new at this
so could use some pointers on best practices for learning wsh programming.
none of the books are out yet.

    your site has been helpful but I am what learning path I should follow
so the learning is incremental.

    mike



Thu, 14 Jun 2001 03:00:00 GMT  
 setting default printer based on sorkstation location for romaming profile
If you are using DHCP and Roaming Profiles then there isn't much else
to key on.  There isn't a simple way for the server to "know" where
the computers are physically located.

Some suggestions, all three require a trip to the workstations:

1.  Use the MAC address.  This would be time consuming to set up, and
difficult to maintain.

2.  Use something in the workstation name.  You could have all the odd
numbers print to one printer...  Would require parsing out the
workstation name, and most likely the renaming of some workstations.

3.  Check for the existence of a file.  This could be a simple 0 byte
file in the Winnt directory.  Create the file using:

REM>c:\winnt\printera.txt

Then in the login script you could simply use:

If exist c:\winnt\printera.txt net use lpt1: \\server\printera
If not exist c:\winnt\printera.txt net use lpt1: \\server\printerb

This would be very easy to setup and maintain, and you would only have
to go to half of the workstations.  The biggest disadvantage is that
you don't get to learn a whole lot about WSH.

My philosophy is, "Don't use a bigger hammer than you need to."  You
can still learn about WSH for other things though.

On Sun, 27 Dec 1998 04:52:25 -0500, "mike mccafferty"

Quote:

>    thanks for the reply. we are using dhcp to assign addresses for the
>workstations with 30 day leases. I should also mention that I am new at this
>so could use some pointers on best practices for learning wsh programming.
>none of the books are out yet.

>    your site has been helpful but I am what learning path I should follow
>so the learning is incremental.

>    mike

Clay Calvert, MCSE
www.languru.com/multimon.htm
Remove the "x" in my e-mail address to reply.


Thu, 14 Jun 2001 03:00:00 GMT  
 setting default printer based on sorkstation location for romaming profile

Hi Mike

I have an idea how to solve your problem. It is easier to explain using CMD but it is easy (I believe) to be done using VBS or JS later.

It seems you have to divide your computers in two groups and set as default printer the nearest one.
And because you want to use roaming profiles, you have to do this every time when a user logs in.

1. There are no groups of computers in NT. But you can do it in this way. Just make two separated TXT files and put all computer names near to printer A it first text file and all computer names near to printer B in second one.

2. Use Con2Prt.exe from MS Zero Administration Kit to set your default printer. Hire is a cut/paste from ZAK documentation:
  Con2Prt provides scriptable functionality to the Add Printer wizard, so that you can simply write a script to add printers on client computers. Lets the user disconnect all existing connections to Windows NT printers and connect to newly specified Windows NT printers.
  Usage: CON2PRT [ /? | /h | /f |
  [/c \\printserver\share | /cd \\printserver\share]+]
  where:
  /?  - displays usage.
  /h  - displays usage.
  /f  - deletes all existing printer connections.
  /c  - connects to \\printserver\share printer.
  /cd - connects to \\printserver\share printer and sets it as the default printer.
The final script could be:
  find.exe "%computername%" Group_of_Computers_A.txt >nul
  if not  '%errorlevel%' == '0' GOTO NOT_A
  Con2Prt /cd \\PrintSertverA\share
  goto Continue

  :NOT_A
  find.exe "%computername%" Group_of_Computers_B.txt >nul
  if not '%errorlevel%' == '0' GOTO NOT_B
  Con2Prt /cd \\PrintSertverB\share
  goto Continue

  :NOT_B
  Echo The %computername% is not font ...

  :CONTINUE

You can find con2prt.exe from Microsoft.com
If you have any problems converting this to VBS (if the is a need), please let me know.

Stilian



Thu, 14 Jun 2001 03:00:00 GMT  
 setting default printer based on sorkstation location for romaming profile

Quote:
>2.  Use something in the workstation name.  You could have all the odd
>numbers print to one printer...  Would require parsing out the
>workstation name, and most likely the renaming of some workstations.

i like this approach because it seem more scalable

the printers have the room number and whether they are a or b in their name.

if we adopted a naming conviention for the workstations the included the
room number and an a or b we would have a group of computers something like
ws12345-rm123a the 12345 is the asset tag number

when new systems were added to the lab they would conform to the new naming
convention and would then be able to have their default printe determined
for them if it is possible to parse the computer and printeer names using
wsh

how would we use wsh to parse the names?

mike



Fri, 15 Jun 2001 03:00:00 GMT  
 setting default printer based on sorkstation location for romaming profile

WshNetwork.ComputerName would do the trick.

Clarence
Check it out
http://cwashington.netreach.net

Win32 bit scripting. Everything you need to get up and running,
A script repository containing almost 100 sample scripts,
downloads, reference files, and technical support via an
online discussion forum.

(Pursuant to US Code, Title 47, Chapter 5, Subchapter II, 227, any and all
unsolicited commercial E-mail sent to this address is subject to a download
and archival fee in the amount of $1000 US.  E-mailing denotes acceptance of
these terms.)

Quote:

>2.  Use something in the workstation name.  You could have all the odd
>numbers print to one printer...  Would require parsing out the
>workstation name, and most likely the renaming of some workstations.

i like this approach because it seem more scalable

the printers have the room number and whether they are a or b in their name.

if we adopted a naming conviention for the workstations the included the
room number and an a or b we would have a group of computers something like
ws12345-rm123a the 12345 is the asset tag number

when new systems were added to the lab they would conform to the new naming
convention and would then be able to have their default printe determined
for them if it is possible to parse the computer and printeer names using
wsh

how would we use wsh to parse the names?

mike



Fri, 15 Jun 2001 03:00:00 GMT  
 setting default printer based on sorkstation location for romaming profile
Once you have the computername then use something like:  
 PrinterID = Right(ComputerName, 1)
to get "A" or "B" in a variable.

On Mon, 28 Dec 1998 10:12:09 -0600, "Clarence Washington Jr."

Quote:

>WshNetwork.ComputerName would do the trick.

>Clarence
>Check it out
>http://cwashington.netreach.net

>Win32 bit scripting. Everything you need to get up and running,
>A script repository containing almost 100 sample scripts,
>downloads, reference files, and technical support via an
>online discussion forum.

>(Pursuant to US Code, Title 47, Chapter 5, Subchapter II, 227, any and all
>unsolicited commercial E-mail sent to this address is subject to a download
>and archival fee in the amount of $1000 US.  E-mailing denotes acceptance of
>these terms.)


>>2.  Use something in the workstation name.  You could have all the odd
>>numbers print to one printer...  Would require parsing out the
>>workstation name, and most likely the renaming of some workstations.

>i like this approach because it seem more scalable

>the printers have the room number and whether they are a or b in their name.

>if we adopted a naming conviention for the workstations the included the
>room number and an a or b we would have a group of computers something like
>ws12345-rm123a the 12345 is the asset tag number

>when new systems were added to the lab they would conform to the new naming
>convention and would then be able to have their default printe determined
>for them if it is possible to parse the computer and printeer names using
>wsh

>how would we use wsh to parse the names?

>mike

Clay Calvert, MCSE
www.languru.com/multimon.htm
Remove the "x" in my e-mail address to reply.


Sat, 16 Jun 2001 03:00:00 GMT  
 
 [ 9 post ] 

 Relevant Pages 

1. Setting connection defaults (proxy, home page) based on location

2. Setting Printer Defaults based on Computer Name

3. script set default printer based on...

4. setting default selected menu based on first selection??

5. Set LOCAL Printer as default printer

6. Change Default Printer based on Logon User

7. Problems setting default printer

8. Programmatically Changing default Printer Settings

9. setting default font on a postscript printer

10. setting default font on a printer

11. Set Printer properties (papersize) for default system prnter

12. Setting default printer in logon process

 

 
Powered by phpBB® Forum Software