PRNADMIN & powershell

Author Message
struttshumming

  • Total Posts : 8
  • Scores: 0
  • Reward points : 0
  • Joined: 3/14/2008
  • Status: offline
PRNADMIN & powershell Thursday, October 09, 2008 5:50 AM (permalink)
0
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
 
#1
    dm_4ever

    • Total Posts : 3687
    • Scores: 82
    • Reward points : 0
    • Joined: 6/29/2006
    • Location: Orange County, California
    • Status: offline
    RE: PRNADMIN & powershell Friday, October 10, 2008 2:24 AM (permalink)
    0
    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
     
    #2
      struttshumming

      • Total Posts : 8
      • Scores: 0
      • Reward points : 0
      • Joined: 3/14/2008
      • Status: offline
      RE: PRNADMIN & powershell Sunday, October 12, 2008 7:48 PM (permalink)
      0
      cool, works fine. thing i need a new IDE with better telesence.
       
      #3

        Online Bookmarks Sharing: Share/Bookmark

        Jump to:

        Current active users

        There are 0 members and 1 guests.

        Icon Legend and Permission

        • 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
        • Read Message
        • Post New Thread
        • Reply to message
        • Post New Poll
        • Submit Vote
        • Post reward post
        • Delete my own posts
        • Delete my own threads
        • Rate post

        2000-2012 ASPPlayground.NET Forum Version 3.9