![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
br> br> |
| |||||||
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| Guest | Term Server Printing Hi all-- I have a client running a Window 2003 Terminal Server. One of the apps running on the server requires printing to LPT2. I need to write a script that will perform the following: 1. Determine the default printer (as setup by the term serv) 2. Share the default printer using a standard naming convention 3. Map LPT2 to the newly-created share name (similar to net use lpt2: \\server\share) I am a complete scripting novice and have decided that rather than "go back" to VBScript / WSH, I should start out of the gate using PowerShell. Questions: 1. Am I right in going the PowerShell route? I have seen Claudio Rodriguez' TS Kixstart script for accomplishing a very similar task. How about WSH/VBScript?? 2. Of the books available on the market, any recommendations? Thanks, Bryce |
My System Specs![]() |
| | #2 (permalink) |
| Guest | Re: Term Server Printing (i'm replying twice, ones for your code question and once for the meta- discussion.) > 1. Am I right in going the PowerShell route? IMHO think your time would be better spent learning PSH rather than VBscript. As to whether powershell is most suited to this particular problem, this is somewhat close to a login script discussion held here recently: http://groups.google.com/group/micro...679e541c3125cf Read that for some thoughts on using psh as a login script. > 2. Of the books available on the market, any recommendations? I am reading "Powershell in Action" and enjoying it. |
My System Specs![]() |
| | #3 (permalink) |
| Guest | Re: Term Server Printing On Jul 10, 12:25 pm, "Bryce Ingalls" <b...@nospam.com> wrote: > 1. Determine the default printer (as setup by the term serv) > 2. Share the default printer using a standard naming convention > 3. Map LPT2 to the newly-created share name (similar to net use lpt2: > \\server\share) I'll let someone else put this together into a script, but here's how you find this sort of info out: 28# $a = Get-WmiObject Win32_Printer 29# $a | get-member TypeName: System.Management.ManagementObject#root \cimv2\Win32_Printer Name MemberType Definition ---- ---------- ---------- CancelAllJobs Method System.Management.ManagementBaseObject CancelAllJobs() Pause Method System.Management.ManagementBaseObject Pause() PrintTestPage Method System.Management.ManagementBaseObject PrintTestPage() .... 30# $a.GetType() IsPublic IsSerial Name BaseType -------- -------- ---- -------- True True Object[] System.Array It's an array, and they are indexed by brackets, starting at 0. e.g. $a[0]. Just typing $a at a prompt will list them, or you can pipe it through format-list or format-table. Here you can see I have 4 printers installed: 39# $a | Format-Table Location Name PrinterState PrinterStatus ShareName SystemName -------- ---- ------------ ------------- --------- ---------- Microsoft XPS D... 0 3 ATLLAPHROTTENBE CutePDF Writer 0 3 ATLLAPHROTTENBE Building B 5th ... \\atla-prnt01\B... 0 3 B5-Canon01 \\atla-prnt01 Bldg B 5th Floo... \\atla-prnt01\B... 0 3 B5-Canon02 \\atla-prnt01 Let's see what happens if I examine the Default property (which you'll see in the Get-Member statement above if you run it) of the 3rd printer, again remembering arrays start at 0. 38# $a[2].Default True That's the default printer. How to find the share name? 44# $prnPath = $a[2].Name 45# $prnPath \\atla-prnt01\B5-Canon01 Then a "net use lpt2: $prnPath" would finish the mapping. HTH |
My System Specs![]() |
| | #4 (permalink) |
| Guest | Re: Term Server Printing Thanks for the script example and book recommendation. Will give this a whirl... Bryce "Hal Rottenberg" <halr9000@gmail.com> wrote in message news:1184086703.515874.203530@o61g2000hsh.googlegroups.com... > On Jul 10, 12:25 pm, "Bryce Ingalls" <b...@nospam.com> wrote: >> 1. Determine the default printer (as setup by the term serv) >> 2. Share the default printer using a standard naming convention >> 3. Map LPT2 to the newly-created share name (similar to net use lpt2: >> \\server\share) > > I'll let someone else put this together into a script, but here's how > you find this sort of info out: > > 28# $a = Get-WmiObject Win32_Printer > 29# $a | get-member > > > TypeName: System.Management.ManagementObject#root > \cimv2\Win32_Printer > > Name MemberType Definition > ---- ---------- ---------- > CancelAllJobs Method > System.Management.ManagementBaseObject CancelAllJobs() > Pause Method > System.Management.ManagementBaseObject Pause() > PrintTestPage Method > System.Management.ManagementBaseObject PrintTestPage() > ... > > 30# $a.GetType() > > IsPublic IsSerial Name BaseType > -------- -------- ---- -------- > True True Object[] > System.Array > > It's an array, and they are indexed by brackets, starting at 0. e.g. > $a[0]. > > Just typing $a at a prompt will list them, or you can pipe it through > format-list or format-table. > > Here you can see I have 4 printers installed: > > 39# $a | Format-Table > > Location Name PrinterState > PrinterStatus ShareName SystemName > -------- ---- ------------ > ------------- --------- ---------- > Microsoft XPS D... > 0 3 ATLLAPHROTTENBE > CutePDF Writer > 0 3 ATLLAPHROTTENBE > Building B 5th ... \\atla-prnt01\B... > 0 3 B5-Canon01 \\atla-prnt01 > Bldg B 5th Floo... \\atla-prnt01\B... > 0 3 B5-Canon02 \\atla-prnt01 > > Let's see what happens if I examine the Default property (which you'll > see in the Get-Member statement above if you run it) of the 3rd > printer, again remembering arrays start at 0. > > 38# $a[2].Default > True > > That's the default printer. How to find the share name? > > 44# $prnPath = $a[2].Name > 45# $prnPath > \\atla-prnt01\B5-Canon01 > > Then a "net use lpt2: $prnPath" would finish the mapping. > > HTH > |
My System Specs![]() |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Printing From School Server | C J | Vista networking & sharing | 2 | 03-22-2008 08:59 PM |
| Re: printing on server 2003 x64 | Bruce Sanderson | Vista print fax & scan | 0 | 03-09-2008 10:02 PM |
| Vista & XP mixed Term Serv printing | Marc Medina | Vista print fax & scan | 0 | 10-17-2007 11:25 AM |
| Command doesn't work in PowerShell term but works in DOS term | Frank | PowerShell | 3 | 06-14-2007 02:19 PM |
| The term '>' is not recognized as a cmdlet | vinod | PowerShell | 2 | 03-16-2007 08:14 AM |