Solved

Login script not working

Posted on 2011-03-10
3
500 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
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:dstewartjr
ID: 35104756
0
 

Author Closing Comment

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

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

In this article we want to have a look at the directory attributes which are used by Microsoft to store the so called Security Identifiers (SID). These SIDs plays an important role in delegating and granting permissions and in authentication of trus…
Not long ago I saw a question in the VB Script forum that I thought would not take much time. You can read that question (Question ID  (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_28455246.html)28455246) Here (http…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

758 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now