[windows2000] Re: Is it possible that terminal services could change a user's default printer?

  • From: "Sullivan, Glenn" <GSullivan@xxxxxxxxxxxxxx>
  • To: <windows2000@xxxxxxxxxxxxx>
  • Date: Thu, 23 Sep 2004 12:44:45 -0400

Here goes...

Background: when I first set up my terminal services, I created "local" 
printers for each network queue, so that I wouldn't have to deal with scripting 
printer installation for each user...

<--------start SavePrinter.vbs LOGOFF script-------->
1. Option Explicit
2. Dim strRegKey, strPrinter
3. Dim objShell, objFSO, objNet
4. Dim objFolder, objTextFile
5. ' Create the Shell Scripting object
6. Set objShell = WScript.CreateObject("WScript.Shell")
7. Set objFSO = CreateObject("Scripting.FileSystemObject")
8. Set objNet = CreateObject("WScript.NetWork") 
9. 'Create the folder, if it does not exist
10. If Not objfso.FolderExists("\\DCSvrFiles01\TSHome\" & objnet.UserName & 
"\DefaultPrinter") Then
11.  Set objFolder = objFSO.CreateFolder("\\DCSvrFiles01\TSHome\" & 
objnet.UserName & "\DefaultPrinter")
12. End If
13. 'Delete the file if it exists
14. If objfso.FileExists("\\DCSvrFiles01\TSHome\" & objnet.UserName & 
"\DefaultPrinter\DefaultPrinter.txt")then
15.  objFSO.DeleteFile("\\DCSvrFiles01\TSHome\" & objnet.UserName & 
"\DefaultPrinter\DefaultPrinter.txt")
16. End If
17. 'Create a new text file
18. Set objTextFile = objFSO.CreateTextFile("\\DCSvrFiles01\TSHome\" & 
objnet.UserName & "\DefaultPrinter\DefaultPrinter.txt")
19. ' Get the current Default Printer, and write it into the text file
20. strRegKey = "HKEY_CURRENT_USER\Software\Microsoft\Windows 
NT\CurrentVersion\Windows\Device"
21. strPrinter = objShell.RegRead(strRegKey)
22. objTextFile.WriteLine(strPrinter)
23. objTextFile.Close
<--------end SavePrinter.vbs LOGOFF script-------->

<--------start LoadPrinter.vbs LOGOn script-------->
1. Option Explicit
2. Dim strRegKey, strPrinter, strPrinterName
3. Dim objShell, objFSO, objNet
4. Dim objFolder, objTextFile
5. ' Create the Shell Scripting object
6. Set objShell = WScript.CreateObject("WScript.Shell")
7. Set objFSO = CreateObject("Scripting.FileSystemObject")
8. Set objNet = CreateObject("WScript.NetWork") 
9. If objfso.FileExists("\\DCSvrFiles01\TSHome\" & objnet.UserName & 
"\DefaultPrinter\DefaultPrinter.txt")Then
10.  Set objTextFile=objFSO.OpenTextFile("\\DCSvrFiles01\TSHome\" & 
objnet.UserName & "\DefaultPrinter\DefaultPrinter.txt")
11.  strPrinter=objTextFile.ReadLine
12.  If instr(1,strPrinter,",")>0 Then
13.   strPrinterName = left(strPrinter,instr(1,strPrinter,",")-1)
14.  End If
15.  strRegKey = "HKEY_CURRENT_USER\Software\Microsoft\Windows 
NT\CurrentVersion\Windows\Device"
16.  objShell.RegWrite strRegKey, strPrinter
17. Else
18.  strRegKey = "HKEY_CURRENT_USER\Software\Microsoft\Windows 
NT\CurrentVersion\Windows\Device"
19.  strPrinter= objShell.RegRead(strRegKey)
20.  If instr(1,strPrinter,",")>0 Then
21.   strPrinterName = left(strPrinter,instr(1,strPrinter,",")-1)
22.  End If
23.  If len(strPrinterName) < 32 Then
24.   strPrinterName = space((55-len(StrPrinterName))/2) & strPrinterName
25.  End If
26.  MsgBox "Your default printer may be set incorrectly." & vbCrlf & "    
Please check and ensure it is correct." & vbCrlf & "                  It is 
currently set to:" & vbCrlf & vbCrlf & strPrinterName
27. End If
<--------End LoadPrinter.vbs LOGOn script-------->

Make sure that you remove the line numbers... If a line doesn't have a number, 
it wrapped.  Un wrap it before you go.

These will run fine "stand-alone" if you want to test them... "CSCRIPT 
<scriptname>.vbs"

HTH,

Glenn Sullivan, MCSE+I  MCDBA
David Clark Company Inc. 
-----Original Message-----
From: windows2000-bounce@xxxxxxxxxxxxx 
[mailto:windows2000-bounce@xxxxxxxxxxxxx] On Behalf Of Bill Beckett
Posted At: Thursday, September 23, 2004 11:54 AM
Posted To: Windows 2000
Conversation: [windows2000] Re: Is it possible that terminal services could 
change a user's default printer?
Subject: [windows2000] Re: Is it possible that terminal services could change a 
user's default printer?


Yes Glenn, share. 

-----Original Message-----
From: Sullivan, Glenn [mailto:GSullivan@xxxxxxxxxxxxxx]
Sent: Thursday September 23, 2004 11:20 AM
To: windows2000@xxxxxxxxxxxxx
Subject: [windows2000] Re: Is it possible that terminal services could change a 
user's default printer?


Rod,

I had lots of problems with Terminal Server Profiles having their default
printer's changed.

So I implemented a combination logoff/logon script to save their default
printer to a text file on their home drive, and reset it when they log back
on.

I can share, if you'd like...

Glenn Sullivan, MCSE+I  MCDBA
David Clark Company Inc. 
-----Original Message-----
From: windows2000-bounce@xxxxxxxxxxxxx
[mailto:windows2000-bounce@xxxxxxxxxxxxx] On Behalf Of Rod Falanga Posted
At: Thursday, September 23, 2004 11:10 AM Posted To: Windows 2000
Conversation: Is it possible that terminal services could change a user's
default printer?
Subject: [windows2000] Is it possible that terminal services could change a
user's default printer?


We are using terminal server on a Windows 2000 Server.  Some users of
terminal services are claiming that it is resetting their default printer
from <whatever> to a Samsung printer that is defined on the terminal server.
I don't think it is possible for the terminal server to change a user's
default printer, but I could be wrong.

Is it possible that the terminal server is changing the default printer to
something else?

And if this isn't the case, what could be changing the default printer for
them?  (The majority of these users haven't a clue as to how to change
anything with their printers' settings/configurations.)

 
________________________________________
Rod Falanga
http://amci.unm.edu
 

********************************************************
This Weeks Sponsor StressedPuppy.com Games Feeling stressed out? Check out
our games to relieve your stress. http://www.StressedPuppy.com
********************************************************
To Unsubscribe, set digest or vacation
mode or view archives use the below link.

http://thethin.net/win2000list.cfm
********************************************************
This Weeks Sponsor StressedPuppy.com Games
Feeling stressed out? Check out our games to
relieve your stress.
http://www.StressedPuppy.com
********************************************************
To Unsubscribe, set digest or vacation
mode or view archives use the below link.

http://thethin.net/win2000list.cfm
********************************************************
This Weeks Sponsor StressedPuppy.com Games
Feeling stressed out? Check out our games to
relieve your stress.
http://www.StressedPuppy.com
********************************************************
To Unsubscribe, set digest or vacation
mode or view archives use the below link.

http://thethin.net/win2000list.cfm
********************************************************
This Weeks Sponsor StressedPuppy.com Games
Feeling stressed out? Check out our games to
relieve your stress.
http://www.StressedPuppy.com
********************************************************
To Unsubscribe, set digest or vacation
mode or view archives use the below link.

http://thethin.net/win2000list.cfm

Other related posts: