Re: Logon Script
From: Al Dunbar [MS-MVP] (alan-no-drub-spam_at_hotmail.com)
Date: 12/31/04
- Next message: jong: "can't get access to disk share when connecting from a remote syste"
- Previous message: Al Dunbar [MS-MVP]: "Re: Logon Script"
- In reply to: Andrew Austen: "Re: Logon Script"
- Next in thread: Al Dunbar [MS-MVP]: "Re: Logon Script"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 31 Dec 2004 10:21:13 -0700
"Andrew Austen" <aausten@bigpond.net.au> wrote in message
news:OvJA6Eu7EHA.3836@tk2msftngp13.phx.gbl...
> Hi Jaime,
>
> I use the following, which you will need to customise for your own
> environment of course.
>
> Dim UserName
> Dim Domain
>
> on error resume next
> Set wshShell = WScript.CreateObject("WScript.Shell")
> on error resume next
> Set WSHNetwork = WScript.CreateObject("WScript.Network")
> on error resume next
> Set WSHEnv = wshShell.Environment
>
>
> Username = ""
> While UserName = ""
> on error resume next
> UserName = UCASE(WSHNetwork.UserName)
> WEnd
>
> Set UserObj = GetObject("WinNT://DOMAINNAME/"& username)
> ' Set Home Directory
> MapDrive "x:", "\\servername\" & username & "$"
> ' Map Drives by Group
> For Each GroupObj In UserObj.Groups
> select case groupobj.name
> case "Domain Admins" MapDrive "z:", "\\servername\c$"
> MapDrive "y:",
> "\\servername\share2$"
> case "HelpDesk" MapDrive "y:", "\\servername\share2$"
> end select
> Next
>
>
>
'###########################################################################
###########
> '
> ' End Map Network Drives
> '
>
'###########################################################################
###########
>
> Sub MapDrive (driveletter, UNCString)
> On Error Resume Next
> WSHNetwork.RemoveNetworkDrive driveletter
> WSHNetwork.MapNetworkDrive driveletter, Uncstring
> End sub
An interesting approach. Unfortunately, this will test only direct
membership, and not membership that is inherited through group nesting in an
Active Directory environment.
/Al
>
>
>
> Cheers
>
> Andrew
>
>
> "Jaime" <Jaime@discussions.microsoft.com> wrote in message
> news:25C81D56-1C9A-4A0D-B92C-983E9C312221@microsoft.com...
> >I am looking for a script that users can run at logon that will map
drives
> > and printers. I would like for it to check what group the users belong
to
> > (global group.."Accounting", "Finance") and then map the corresponding
> > drives. We are currently using batch files that are for specific groups
> > and
> > I would like to consolidate them into one file for easy maintenance. We
> > have
> > no need to keep batch files. We are open to any scripting language.
> >
> >
> > Jaime
> >
>
>
- Next message: jong: "can't get access to disk share when connecting from a remote syste"
- Previous message: Al Dunbar [MS-MVP]: "Re: Logon Script"
- In reply to: Andrew Austen: "Re: Logon Script"
- Next in thread: Al Dunbar [MS-MVP]: "Re: Logon Script"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|