Glenn, How do your scripts below save a file to the users of terminal services? I would have thought that the terminal service wouldn't save anything to the user's PC. Rod -----Original Message----- Msg: #18 in digest Subject: [windows2000] Re: Is it possible that terminal services could change a Date: Thu, 23 Sep 2004 12:44:45 -0400 From: "Sullivan, Glenn" <GSullivan@xxxxxxxxxxxxxx> 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 =3D WScript.CreateObject("WScript.Shell") 7. Set objFSO =3D CreateObject("Scripting.FileSystemObject") 8. Set objNet =3D CreateObject("WScript.NetWork")=20 9. 'Create the folder, if it does not exist 10. If Not objfso.FolderExists("\\DCSvrFiles01\TSHome\" & = objnet.UserName & "\DefaultPrinter") Then 11. Set objFolder =3D 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 =3D objFSO.CreateTextFile("\\DCSvrFiles01\TSHome\" & = objnet.UserName & "\DefaultPrinter\DefaultPrinter.txt") 19. ' Get the current Default Printer, and write it into the text file 20. strRegKey =3D "HKEY_CURRENT_USER\Software\Microsoft\Windows = NT\CurrentVersion\Windows\Device" 21. strPrinter =3D 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 =3D WScript.CreateObject("WScript.Shell") 7. Set objFSO =3D CreateObject("Scripting.FileSystemObject") 8. Set objNet =3D CreateObject("WScript.NetWork")=20 9. If objfso.FileExists("\\DCSvrFiles01\TSHome\" & objnet.UserName & = "\DefaultPrinter\DefaultPrinter.txt")Then 10. Set objTextFile=3DobjFSO.OpenTextFile("\\DCSvrFiles01\TSHome\" & = objnet.UserName & "\DefaultPrinter\DefaultPrinter.txt") 11. strPrinter=3DobjTextFile.ReadLine 12. If instr(1,strPrinter,",")>0 Then 13. strPrinterName =3D left(strPrinter,instr(1,strPrinter,",")-1) 14. End If 15. strRegKey =3D "HKEY_CURRENT_USER\Software\Microsoft\Windows = NT\CurrentVersion\Windows\Device" 16. objShell.RegWrite strRegKey, strPrinter 17. Else 18. strRegKey =3D "HKEY_CURRENT_USER\Software\Microsoft\Windows = NT\CurrentVersion\Windows\Device" 19. strPrinter=3D objShell.RegRead(strRegKey) 20. If instr(1,strPrinter,",")>0 Then 21. strPrinterName =3D left(strPrinter,instr(1,strPrinter,",")-1) 22. End If 23. If len(strPrinterName) < 32 Then 24. strPrinterName =3D 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.=20 ******************************************************** 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