Solved

Active Directory LOGIN script for ALL USERS on only SOME MACHINES

Posted on 2007-11-30
6
844 Views
Last Modified: 2010-10-05
I am trying to figure out how to run a small script to add a printer when ANY user logs into ONLY LAB computers. The script works if I apply the group policy to all users but it adds the printer to every computer on the network. If I try to restrict by computer or group the script doesn't run. Any ideas?
0
Comment
Question by:ocacadmin
  • 2
6 Comments
 
LVL 16

Accepted Solution

by:
2PiFL earned 250 total points
ID: 20386424
Create an OU for the lab computers, move the lab computers to this OU and apply the GPO to this OU.
0
 
LVL 4

Expert Comment

by:mdefalco
ID: 20386428
You should have the IP addresses of those computers and then you can add them to your script.

First go to this webpage, it will show you how to get the ip address of the machine you are logging into;

http://www.codeproject.com/vbscript/ipaddress.asp

This creates a variable called GetIPAddress, you can now use this in your code. How many computers are in that lab, and are their ips static, if not you should set them to static, or give them a dhcp reservation.

You can now comare the ips in the lab to the current loggen in user ip and tell it to install only on the machines that do not fit this ip.

If they are in a different subnet all together, then you can set them up in AD as a seperate subnet and then add that subnet to the GP, alone. I have done this before but a long time ago, if you need it this way I can help you with that.
0
 

Author Comment

by:ocacadmin
ID: 20399921
I figured out a better solution to my problem:

The reason I was trying to do this is because I thought I could not add printers at the machine level rather than just added printers to user profiles.

You can in fact add printers to Machines, but only at the command line like so:

rundll32 printui.dll,PrintUIEntry /ga /q /n\\server.name\printer-name

The ga switch adds a "per machine printer" that is available to every user that can login to the machine.

After that it just a matter of adding this line to a startup script either through Active Directory or some other means.


rundll32 printui.dll,PrintUIEntry /ga /q /n\\server.name\printer-name

Open in new window

0
 
LVL 4

Expert Comment

by:mdefalco
ID: 20399948
Very cool, thanks for posting that. I think I may have a use for it too,

~ Jim
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Setting up SSH Cisco We are all told that you should not use Telent for connecting to devices because it is unsecure and all clear text. Much better is to use SSH, but it can seem a bit of a challenge setting it all up and especially in a small n…
I was at a customer and we recently set up a new DNS Server.  I asked him to ensure that all servers pointed to the new server.  140 remote servers – estimated 6 days of work to do this manually. Ever had this experience and just need to get the …
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now