Jump to content

Script Input.


Recommended Posts

Guest Joe_IT
Posted

Hiya,

 

Not sure ths is the correct forum, but I'm going to give it a shot.

 

 

Our company just installed 15 new copiers, most networked, all new

drivers and names on the network. I was made responsible to make a

script to add in to our login.bats (we run many different login

scriots depending on where you at in the company and what you need to

do) I have to ad this script to our login scripts to remove the "old"

instances of the copiers these replaced. This has to be done across

Citrix as well and PC workstations. The majority of our workstations

run XP, but we do have a few 2000 machines. But that doesn't matter

they all run the same scipts.

 

 

I was going to try just a simple script code to remove the references

to the printers.

 

 

'REMOVE ALL MAPPED PRINTERS IN THE CLIENT'S CITRIX SESSION

Set objNetwork = WScript.CreateObject("WScript.Network")

Set Printers = objNetwork.EnumPrinterConnections

For i = 0 to Printers.Count - 1 Step 2

strPrinterName = ""

strPrinterName = Printers.Item(i+1)

objNetwork.RemovePrinterConnection strPrinterName,1,1

Next

 

 

But as you can see it's for citrix ?

 

 

Then I found out about the PrintUI.dll call command and just using

it.

 

 

rundll32 printui.dll PrintUIRetry /dn /n\\printerserver\printer1

rundll32 printui.dll PrintUIRetry /dn /n\\printerserver\printer2

 

 

and so on.

 

 

But when I test it in the cmd prompt it fails, says it cant find the

printer and I'm looking at it on my print server.

 

 

I tried the syntax /dn to remove network printers, also tried it on

my

local machine with the /dl to delete local printers, this also

failed.

 

 

It has been ages since I scripted anything. What am I missing, this

isn't rocket science, I just want to remove old instances of thier

printers on thier AD accounts.

 

 

I figure run the script for a few weeks to assure all users are hit

and then remove the bit.

 

 

Thanks in advance.

  • Replies 1
  • Created
  • Last Reply

Popular Days

Guest Priya Raghavan [MSFT]
Posted

Re: Script Input.

 

Try PrintUIEntry instead of PrintUIRetry

 

The command to delete a local printer:

rundll32 printui.dll,PrintUIEntry /dl /n "Printer Name"

 

The command to delete a network printer:

rundll32 printui.dll,PrintUIEntry /dn /n "\\MachineName\PrinterName"

 

--

Thanks,

Priya.

 

--

This posting is provided "AS IS" with no warranties, and confers no rights.

 

"Joe_IT" <jlang@outlookgroup.com> wrote in message

news:fd2f95de-c10d-4233-be56-d082e4aaf232@f3g2000hsg.googlegroups.com...

> Hiya,

>

> Not sure ths is the correct forum, but I'm going to give it a shot.

>

>

> Our company just installed 15 new copiers, most networked, all new

> drivers and names on the network. I was made responsible to make a

> script to add in to our login.bats (we run many different login

> scriots depending on where you at in the company and what you need to

> do) I have to ad this script to our login scripts to remove the "old"

> instances of the copiers these replaced. This has to be done across

> Citrix as well and PC workstations. The majority of our workstations

> run XP, but we do have a few 2000 machines. But that doesn't matter

> they all run the same scipts.

>

>

> I was going to try just a simple script code to remove the references

> to the printers.

>

>

> 'REMOVE ALL MAPPED PRINTERS IN THE CLIENT'S CITRIX SESSION

> Set objNetwork = WScript.CreateObject("WScript.Network")

> Set Printers = objNetwork.EnumPrinterConnections

> For i = 0 to Printers.Count - 1 Step 2

> strPrinterName = ""

> strPrinterName = Printers.Item(i+1)

> objNetwork.RemovePrinterConnection strPrinterName,1,1

> Next

>

>

> But as you can see it's for citrix ?

>

>

> Then I found out about the PrintUI.dll call command and just using

> it.

>

>

> rundll32 printui.dll PrintUIRetry /dn /n\\printerserver\printer1

> rundll32 printui.dll PrintUIRetry /dn /n\\printerserver\printer2

>

>

> and so on.

>

>

> But when I test it in the cmd prompt it fails, says it cant find the

> printer and I'm looking at it on my print server.

>

>

> I tried the syntax /dn to remove network printers, also tried it on

> my

> local machine with the /dl to delete local printers, this also

> failed.

>

>

> It has been ages since I scripted anything. What am I missing, this

> isn't rocket science, I just want to remove old instances of thier

> printers on thier AD accounts.

>

>

> I figure run the script for a few weeks to assure all users are hit

> and then remove the bit.

>

>

> Thanks in advance.

>

>


×
×
  • Create New...