Jump to content

Looking for input, 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 4
  • Created
  • Last Reply

Popular Days

Guest - Michel
Posted

RE: Looking for input, script input.

 

Hi,

 

Why not just use "net use" (/del) in a batch during logon of the user? Easy

to script and far more easier?

 

Kind regards,

Michel

 

"Joe_IT" wrote:

> 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.

>

Guest Joe_IT
Posted

Re: Looking for input, script input.

 

On Jan 3, 2:39 pm, - Michel <Mic...@discussions.microsoft.com> wrote:

> Hi,

>

> Why not just use "net use" (/del) in a batch during logon of the user? Easy

> to script and far more easier?

>

> Kind regards,

> Michel

>

>

>

> "Joe_IT" wrote:

> > 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.- Hide quoted text -

>

> - Show quoted text -

 

Hrm,

I'm not real familiar with that syntax...what would one use to remove

a printer by name off a client workstation.

 

net use /del printername ???

Guest Joe_IT
Posted

Re: Looking for input, script input.

 

On Jan 3, 2:39 pm, - Michel <Mic...@discussions.microsoft.com> wrote:

> Hi,

>

> Why not just use "net use" (/del) in a batch during logon of the user? Easy

> to script and far more easier?

>

> Kind regards,

> Michel

>

>

>

> "Joe_IT" wrote:

> > 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.- Hide quoted text -

>

> - Show quoted text -

 

That clears the connection but does not remove the printer definition

from the Printers & Faxes box.

Guest - Michel
Posted

Re: Looking for input, script input.

 

Yep, easy as that:

 

connect:

net use \\printserver\printername

disconnect:

net use \\printserver\printername /del /y (/del = delete, /y = force)

 

"Joe_IT" wrote:

> On Jan 3, 2:39 pm, - Michel <Mic...@discussions.microsoft.com> wrote:

> > Hi,

> >

> > Why not just use "net use" (/del) in a batch during logon of the user? Easy

> > to script and far more easier?

> >

> > Kind regards,

> > Michel

> >

> >

> >

> > "Joe_IT" wrote:

> > > 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.- Hide quoted text -

> >

> > - Show quoted text -

>

> Hrm,

> I'm not real familiar with that syntax...what would one use to remove

> a printer by name off a client workstation.

>

> net use /del printername ???

>


×
×
  • Create New...