Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
option explicit
Dim WSHNetwork, ADSysInfo, strCurrentUser, errCode
Set WSHNetwork = CreateObject("WScript.Network")
Set ADSysInfo = CreateObject("ADSystemInfo") 'Returns the Distinguished Name of the current User
strCurrentUser = ADSysInfo.UserName)
If instr (strCurrentUser, "OU1") <> 0 Then
errCode = AddPrinter (\\Printserver\Printer1)
elseif instr (strCurrentUser, "OU2") <> 0 Then
errCode = AddPrinter (\\Printserver\Printer2)
EndIf
Function AddPrinter (ByVal strPrinterUNC)
'Description: Mapps a the given printer
'Returns: a string with the result...
Dim NetPrinter : Set NetPrinter = CreateObject("WScript.Network")
On Error Resume Next
Err.Number = 0
NetPrinter.AddWindowsPrinterConnection strPrinterUNC
Select Case Err.number
Case 0
AddPrinter = "Printer Connected..."
Case -2147023095
AddPrinter = vbcrlf & "ERROR - The network name cannot be found (Mistyped Server, or Printer name)"
Case Else
AddPrinter = vbcrlf & "ERROR While connecting Printer. " & Err.Number & " - " & Err.Description
End Select
NetPrinter.SetDefaultPrinter strPrinterUNC
On Error goto 0
Set NetPrinter = Nothing
End Function