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.
' On Error Resume Next
'3 initial object creation
Dim strDomain, strUser ' (Declare variables at top)
Dim WSHNetwork, objGroup , UserObj
Set WSHShell = CreateObject("WScript.Shell")
set objNetwork = WScript.createObject("WScript.Network")
DomainString = objNetwork.UserDomain
UserString = objNetwork.UserName
Set UserObj = GetObject("WinNT://" & objNetwork.UserDomain & "/" & UserString)
'Welcome Message
'MsgBox "Welcome to the " & DomainString & " Network, " & UserString & "!"
Sub MapPrinters(UserString)
'This is set at the top of the script.
'set objNetwork = WScript.createObject("WScript.Network")
'Now check for group memberships and select the correct Case
strCounter = 0 ' Initialize counter
For Each GroupObj In UserObj.Groups
WScript.Echo UCase(GroupObj.Name) ' (Insert echo command for troubleshooting)
Select Case UCase(GroupObj.Name) ' Convert to Upper Case for consistency
'Check for group memberships and take needed action
Case "025"
If strCounter > 0 Then
WScript.Echo "User is member of multiple banks"
Exit For ' Causes For...Next loop to end
Else
strCounter = strCounter + 1 ' Increment counter for next loop
End If
objNetwork.SetDefaultPrinter "\\LXOLCDPRN01\First Floor C450"
Case "052"
If strCounter > 0 Then
WScript.Echo "User is member of multiple banks"
Exit For ' Causes For...Next loop to end
Else
strCounter = strCounter + 1 ' Increment counter for next loop
End If
objNetwork.SetDefaultPrinter "\\LXOLCDPRN01\Second Floor C450"
Next
I didn't write the script, it already existed when I started in the company. But the person that did create it still works there, so I'm gradually trying to make changes to it. But I like your idea - thanks for that, might have to try that next weekit seems you have locked yourself into using a script you don't like. Why?