Windows Thread, Roaming Profiles Printing in Technical; Hi we are running the script below but when a student is on they get printers from other rooms?
Option ...
-
29th April 2010, 02:02 PM #1
- Rep Power
- 9
Roaming Profiles Printing
Hi we are running the script below but when a student is on they get printers from other rooms?
Option Explicit
DIM RegEntry, ComputerName
RegEntry="HKLM\SYSTEM\CurrentControlSet\Control\Co mputerName\ComputerName\ComputerName"
ComputerName = ReadRegValue(RegEntry)
if InStr(1,ucase(ComputerName),"LAB1-",vbTextCompare) > 0 then call SetPrinter("\\LAB1\LaserJet")
if InStr(1,ucase(ComputerName),"LAB2-",vbTextCompare) > 0 then call SetPrinter("\\LAB2\LaserJet")
if InStr(1,ucase(ComputerName),"OFFICE-",vbTextCompare) > 0 then call SetPrinter("\\OFFICE\LaserJet")
'so on and so forth.
wscript.quit
' *** This subroutine installs and sets the default printer
Sub SetPrinter(ByVal PrinterPath)
DIM WshNetwork
Set WshNetwork = CreateObject("WScript.Network")
WshNetwork.AddWindowsPrinterConnection(PrinterPath )
WshNetwork.SetDefaultPrinter Printerpath
end sub
' **** This function returns the data in the registry value
Function ReadRegValue(ByVal RegValue)
DIM WSHShell
Set WSHShell = WScript.CreateObject("WScript.Shell")
ReadRegValue=""
On Error Resume Next
ReadRegValue= WSHShell.RegRead(RegValue)
End Function
-
-
IDG Tech News
SHARE:
Similar Threads
-
By itgeek in forum Windows
Replies: 8
Last Post: 31st May 2010, 11:41 PM
-
By richard_s in forum How do you do....it?
Replies: 11
Last Post: 31st July 2009, 08:19 PM
-
By d1551 in forum Windows
Replies: 2
Last Post: 9th May 2008, 02:48 PM
-
By Neville in forum Windows
Replies: 9
Last Post: 21st March 2008, 01:34 AM
-
By robbied69 in forum Windows
Replies: 2
Last Post: 25th September 2006, 05:13 PM
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules