Page 1 of 2 12>
Topic Options
#169117 - 2006-10-09 11:00 PM Install IP Printers as Admin
hieucao Offline
Fresh Scripter

Registered: 2006-08-09
Posts: 18
Background: I am using MS VB script to install ip printers via KIX. I call this *.vbs file from a BAT file within KIX and it works fine, but it requires the user to have admin's rights on local computer in order for it to work.

Question:
Is there a way that you can have KIX or VB installs IP printer as 'admin'? Our user profiles do not have sufficient rights on our domain to install printers, so the only way that I know of is to have individual accounts set as "administrator" on local computer...

Current script as followed.

strComputer = "."
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set objNewPort = objWMIService.Get("Win32_TCPIPPrinterPort").SpawnInstance_
objNewPort.Name = "IP_192.168.24.37"
objNewPort.Protocol = 1
objNewPort.HostAddress = "192.168.24.37"
objNewPort.PortNumber = "9100"
objNewPort.SNMPEnabled = False
objNewPort.Put_

Set objPrinter = objWMIService.Get("Win32_Printer").SpawnInstance_
objPrinter.DriverName = "Xerox 4505 PS"
objPrinter.PortName = "IP_192.168.24.37"
objPrinter.DeviceID = "2FLX4500PS"
objPrinter.Location = "Mission Valley Admin"
objPrinter.Network = "True"
'objPrinter.Shared = "True"
'objPrinter.ShareName = "Test"
objPrinter.Put_


If someone knows VB, please help. Any input is greatly appreciated.
Thanks.
Hieu

Top
#169118 - 2006-10-09 11:05 PM Re: Install IP Printers as Admin
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
I would recommend the use of a member server as print server in your domain. I presume you have a domain?
Top
#169119 - 2006-10-09 11:13 PM Re: Install IP Printers as Admin
hieucao Offline
Fresh Scripter

Registered: 2006-08-09
Posts: 18
Yes, I do have a Win2000/2K3 domain. Installing SHARED printers from the print server is not a problem, but installing IP printer for local printing requires users to have admin rights on local PCs. I am hoping that someone with VB exprience can help out with the existing script..

My network situation is a bit unique...locally, they'd like to print to printers via IP, bypassing the print server over the WAN. When printing documents via Citrix, then it'll print through the shared printers on print server.

Thanks for your help.
Hieu

Top
#169120 - 2006-10-09 11:40 PM Re: Install IP Printers as Admin
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
you can't fake rights.
if there is no rights to install printers, then there is not.

Top
#169121 - 2006-10-09 11:52 PM Re: Install IP Printers as Admin
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
If I understand well, you have a remote location with a limited number of computers ( < 10 ) with no domain or member servers?
Top
#169122 - 2006-10-10 12:00 AM Re: Install IP Printers as Admin
hieucao Offline
Fresh Scripter

Registered: 2006-08-09
Posts: 18
Witto / Jooel -
Thank you for your responses. My remote branch has less than 10 computers and no local servers. All domain authentication is done via the WAN back to our central office. The above script will work in the login script if the user has appropriate rights. I was thinking of using a generic username with appropriate rights to install printers from the login script so that I don't have to manually installed the IP printers for that location....if that's possible at all.

Top
#169123 - 2006-10-10 12:08 AM Re: Install IP Printers as Admin
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
well, you could use runAs
or the kixtart version, sanur (or what's it's name)

Top
#169124 - 2006-10-10 12:32 PM Re: Install IP Printers as Admin
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
If you do not have lot of these remote sites (only one if I understand you) I personally would remote control the computers one by one and install the printers. Local installed printers are bound to the computer, not to the user profile. Anyone logging on to that computer has the printer. So IMHO it should not be in the logon script.
I presume you can even do it via the shares in your "Microsoft Windows Network" or "Network Neighbourhood". Browse to the "Printers and Faxes" share on that computer, right-click in the folder and launch the "Add printer" wizard. You should do that as administrator.
You can also decide that "PC1" in your remote site should act as the "print server", install the printer on that machine and share it.
- pro: less maintenance
- contra: the users should not shutdown that computer while people are in the office (logoff is no problem).

Top
#169125 - 2006-10-10 07:59 PM Re: Install IP Printers as Admin
hieucao Offline
Fresh Scripter

Registered: 2006-08-09
Posts: 18
Witto / Jooel - Actually, I've 20 remote locations, and that's why I am looking to automate things. Sure, I can install the printers manually for them, but that'll be the last option though. The existing script works fine..I just need to address the rights issue..

Thank you both for your suggestion.
Hieu

Top
#169126 - 2006-10-11 12:29 AM Re: Install IP Printers as Admin
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
Maybe you can enumerate the computers in a array and run an admin script from your computer...
Top
#169127 - 2006-10-12 06:52 PM Re: Install IP Printers as Admin
hieucao Offline
Fresh Scripter

Registered: 2006-08-09
Posts: 18
I used "reg add" command and TID 314486 from Microsoft and that takes care of what I need.

Thanks, Witto for all of your input.
Hieu

Top
#169128 - 2006-10-12 07:33 PM Re: Install IP Printers as Admin
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4567
Loc: USA
So that other can benefit, what exactly did you do?
Top
#169129 - 2006-10-13 06:51 PM Re: Install IP Printers as Admin
hieucao Offline
Fresh Scripter

Registered: 2006-08-09
Posts: 18
Allen -

We've only 5-6 workstations at remote branches, and we're making changes one branch at a time. We only need to change one laser printer at each remote branch, so this script might not be the most efficient way to installing IP printers, but it'll work. Then, we modified the KIX login script to add the same printer that's shared on the print server when they log into Citrix.

CLS

if not @TSSESSION
$ComputerName = SUBSTR(@wksta, 1, 3)
Addprinterconnection("\\servername\shared_label_printer1")
Addprinterconnection("\\servername\shared_label_printer2")
Use I: "\\servername\%username%"
Use Q: "\\servername\shared_folder"
else
$ComputerName = SUBSTR(%CLIENTNAME%, 1,3)
Addprinterconnection("\\servername\shared_laser_printer")
Addprinterconnection("\\servername\shared_label_printer1")
Addprinterconnection("\\servername\shared_label_printer2") SetDefaultPrinter ("\\servername\shared_laser_printer")= 0

endif


Here's the sample printer script that we tested:

reg add "\\TOMCAT01\HKLM\System\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port\Ports\TestXPort" /v Protocol /t REG_DWORD /d 0x1

reg add "\\TOMCAT01\HKLM\System\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port\Ports\TestXPort" /v Version /t REG_DWORD /d 0x1

reg add "\\TOMCAT01\HKLM\System\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port\Ports\TestXPort" /v HostName /t REG_SZ /d ""

reg add "\\TOMCAT01\HKLM\System\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port\Ports\TestXPort" /v IPAddress /t REG_SZ /d "192.168.24.37"

reg add "\\TOMCAT01\HKLM\System\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port\Ports\TestXPort" /v HWAddress /t REG_SZ /d ""


reg add "\\TOMCAT01\HKLM\System\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port\Ports\TestXPort" /v PortNumber /t REG_DWORD /d 0x238c

reg add "\\TOMCAT01\HKLM\System\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port\Ports\TestXPort" /v "SNMP Community" /t REG_SZ /d "public"

reg add "\\TOMCAT01\HKLM\System\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port\Ports\TestXPort" /v "SNMP Enabled" /t REG_DWORD /d 0x1

reg add "\\TOMCAT01\HKLM\System\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port\Ports\TestXPort" /v "SNMP Index" /t REG_DWORD /d 0x1

psservice \\TOMCAT01 stop spooler (utility from www.sysinternals.com)

psservice \\TOMCAT01 start spooler (utility from www.sysinternals.com)

sleep 15 (utility from Win2K Resource Kit) - may need to increase wait time if going over slow WAN link to allow REG ADD to complete and spooler serivce restarted.

rundll32 printui.dll,PrintUIEntry /if /b "Test Printer" /c\\TOMCAT01 /f \\NEWFOCUS\4500\x4500CL6.inf /r "TestXPort" /m "Xerox Phaser 4500N PCL6"

Top
#169130 - 2006-10-13 06:53 PM Re: Install IP Printers as Admin
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
so, you didn't have ip printers to set up after all.
Top
#169131 - 2006-10-13 06:54 PM Re: Install IP Printers as Admin
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
and why would you use some psService when you can restart spooler with "net stop" and "net start"?
Top
#169132 - 2006-10-13 07:08 PM Re: Install IP Printers as Admin
hieucao Offline
Fresh Scripter

Registered: 2006-08-09
Posts: 18
The IP printer did get installed locally through the printer.bat file as shown above..it's not running via Kix.

I wasn't sure of whether "net stop/start" would be able to restart service on a remote computer, so PsService works out great.

Top
#169133 - 2006-10-13 07:47 PM Re: Install IP Printers as Admin
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
oh, remote.
then xnet would have been good.
sadly it's no longer shipped with kixtart.

Top
#169134 - 2006-10-14 02:42 AM Re: Install IP Printers as Admin
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4567
Loc: USA
I guess I don't see how this helps get around needing admin permissions to install the printer. Care to elaborate?

By the way, the AddPrinter() UDF does pretty much what you are doing here, but it too needs admin privs.

[edit: Are you running the reg edit code as an admin script? If yes, I understand now.... ]


Edited by Allen (2006-10-14 02:46 AM)

Top
#169135 - 2006-10-14 03:14 AM Re: Install IP Printers as Admin
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Ja, remote admin script.

During our AD migration, we used the REG tool to remotely manipulate thousands of PC registries.

Top
#169136 - 2006-10-14 03:16 AM Re: Install IP Printers as Admin
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11631
Loc: CA
Just curious why not KiXtart for the remote Reg?
Top
Page 1 of 2 12>


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 302 anonymous users online.
Newest Members
Sir_Barrington, batdk82, StuTheCoder, M_Moore, BeeEm
17886 Registered Users

Generated in 0.071 seconds in which 0.024 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org