Solved

Login script not working

Posted on 2011-03-10
3
506 Views
Last Modified: 2012-05-11
This login script doesnt work. The bit that isnt working is the conditional mapping of drive G. The admin drive is the only one that seems to work. None of the otehr drive g mappings work.

ON ERROR RESUME NEXT

Dim WSHShell, WSHNetwork, objDomain, DomainString, UserString, UserObj, Path


Set WSHShell = CreateObject("WScript.Shell")
Set WSHNetwork = CreateObject("WScript.Network")

DomainString = Wshnetwork.UserDomain

WinDir = WshShell.ExpandEnvironmentStrings("%WinDir%")
UserString = WSHNetwork.UserName
Set UserObj = GetObject("WinNT://" & DomainString & "/" & UserString)

strComputer = WSHNetwork.ComputerName

WSHNetwork.RemoveNetworkDrive "F:", True, True
WSHNetwork.RemoveNetworkDrive "X:", True, True
WSHNetwork.RemoveNetworkDrive "T:", True, True
WSHNetwork.RemoveNetworkDrive "S:", True, True

wscript.sleep 200

WSHNetwork.MapNetworkDrive "F:", "\\Tasman-srv01\Global$",True
WSHNetwork.MapNetworkDrive "X:", "\\Tasman-db1\ASL_Progs\x1\T_100",True
WSHNetwork.MapNetworkDrive "S:", "\\Tasman-srv01\jobscans",True
WSHNetwork.MapNetworkDrive "T:", "\\Tasman-srv01\Global$\Tradelink",True

For Each GroupObj In UserObj.Groups
    Select Case UCase(GroupObj.Name)

        Case "ADMIN"
            WSHNetwork.MapNetworkDrive "G:", "\\srv01\Accounts$",True
        Case "Production"
            WSHNetwork.MapNetworkDrive "G:", "\\srv01\Production$",True
        Case "Comm"
            WSHNetwork.MapNetworkDrive "G:", "\\srv01\Commercial$",True

       
    End Select
Next

set UserObj = Nothing
set GroupObj = Nothing
set WSHNetwork = Nothing
set DomainString = Nothing
set WSHSHell = Nothing
Set WSHPrinters = Nothing

wscript.quit
0
Comment
Question by:duncaninnz
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 65

Accepted Solution

by:
RobSampson earned 500 total points
ID: 35104116
Hi, you have
Select Case UCase(GroupObj.Name)

to force GroupObj.Name to uppercase, and then you're checking that against "Production" and "Comm", which should be "PRODUCTION" and "COMM".

Regards,

Rob.
0
 
LVL 47

Expert Comment

by:Donald Stewart
ID: 35104756
0
 

Author Closing Comment

by:duncaninnz
ID: 35111434
YEs that works perfectly. Thanks.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Welcome, welcome!  If you are new to the series and haven't been following along, please take a brief moment to review the first three installments: Part 1 (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/A_266-VBScri…
Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question