Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


PRNADMIN & powershell

 
Logged in as: Guest
arrSession:exec spGetSession 2,5,64933
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> Windows PowerShell >> PRNADMIN & powershell
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 PRNADMIN & powershell - 10/9/2008 4:50:57 AM   
  struttshumming

 

Posts: 8
Score: 0
Joined: 3/14/2008
Status: offline
Hi there,

I am tring to use PRNADMIN to create a printer and port on a print server. However I cannot seem to invoke the ADD method.

can any please piont out where i am going wrong?

Here is the code:


$MAS
= New-Object -ComObject  PrintMaster.PrintMaster.1

$POR
= New-Object -ComObject  Port.Port.1

$PTR
= New-Object -ComObject  Printer.Printer.1
 

$POR
.ServerName = "MyPrintServer"

$POR
.PortName = "MyPortName"

$POR
.HostAddress = "MyAddress"

$POR
.PortType = 2

$POR
.QueueName = "Binary_P1"

$MAS
.?   #Need to invode add method her to create port
 

$PTR
.ServerName = "MyPrintServer"

$PTR
.PrinterName = "MyPortName"

$PTR
.DriverName = "HP4 laserjet"

$PTR
.PortName = "MyPortName"

$MAS
.?  #Need to invode add method her to create printer
 

$MAS
.PrinterGet($strPrintServer, $printerName, $PTR)

$PTR
.Comment = "Windows LPR Port"

$PTR
.Location = "MyLocation"

$MAS
.?  #well you know what i mean
 
 
Post #: 1
 
 RE: PRNADMIN & powershell - 10/10/2008 1:24:51 AM   
  dm_4ever


Posts: 2669
Score: 46
Joined: 6/29/2006
From: Orange County, California
Status: offline
Did you try....

$MAS.PortAdd($POR)

this worked for me so if it is not working for you then something else may be wrong.

_____________________________

dm_4ever

My philosophy: K.I.S.S - Keep It Simple Stupid
Read Me: http://www.visualbasicscript.com/m_24727/tm.htm
Frequently Asked Stuff: http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to struttshumming)
 
 
Post #: 2
 
 RE: PRNADMIN & powershell - 10/12/2008 6:48:39 PM   
  struttshumming

 

Posts: 8
Score: 0
Joined: 3/14/2008
Status: offline
cool, works fine. thing i need a new IDE with better telesence.

(in reply to dm_4ever)
 
 
Post #: 3
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> Windows PowerShell >> PRNADMIN & powershell Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts