Solved

Login script not working

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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

Over the years I have built up my own little library of code snippets that I refer to when programming or writing a script.  Many of these have come from the web or adaptations from snippets I find on the Web.  Periodically I add to them when I come…
This article is the result of a quest to better understand Task Scheduler 2.0 and all the newer objects available in vbscript in this version over  the limited options we had scripting in Task Scheduler 1.0.  As I started my journey of knowledge I f…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …

617 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