We have a Multipoint 2012 server running RDS for dumb terminals set up throughout our facility. Clients are named by their location. Each location uses its own printer. Due to the fact that there are more clients than users, we will have a user logged in from multiple locations.
I developed a VBS script that runs on the RDS session to set the default printer depending on where the client is. The code works well. However, when a user is also logged in from different locations, all sessions for that user get the new default printer. This has led to people chasing down paperwork all over the place.
Is there anything I can do to only change the default printer for the current session and not for the entire user profile?
Here is my script:
Dim ClientName
Dim Shell
Dim WSHNetwork
Set Shell = CreateObject("WScript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")
ClientName = LCase(Shell.ExpandEnvironmentStrings("%ClientName%"))
Set WSHNetwork = CreateObject("WScript.Network")
If InStr(ClientName, "inspection") > 0 Then
WSHNetwork.SetDefaultPrinter "[INSPECTION_PRINTER_NAME]"
ElseIf InStr(ClientName, "tooling") > 0 Then
WSHNetwork.SetDefaultPrinter "[TOOLING_PRINTER_NAME]"
ElseIf InStr(ClientName, "assembly") > 0 Then
WSHNetwork.SetDefaultPrinter "[ASSEMBLY_PRINTER_NAME]"
ElseIf InStr(ClientName, "lathe") > 0 Then
WSHNetwork.SetDefaultPrinter "[LATHE_PRINTER_NAME]"
End If
If there is no way to do exactly what I am attempting, I am open to suggestions on doing something differently.