Solved

Login script not working

Posted on 2011-03-10
3
505 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

When it comes to writing scripts for a Client/Server computing environment it is essential to consider some way of enabling the authentication functionality within a script. This sort of consideration mainly comes into the picture when we are dealin…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

735 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