VB script? - TechRepublic
General discussion
December 18, 2002 at 12:26 AM
luc geurts

VB script?

by luc geurts . Updated 23 years, 6 months ago

Problems with log on:
As member of Dossiers it maps rhe drive.
As member of Directie or JZ it maps the drive and gives error: the local device name is already in use.???
Script runs in a policy as startup script in part user configuration.

‘Sript can be set up to map network drives
‘and printers using the IsMember(“Group Name”)
‘function to determine group membership. Script
‘will also map drives and printers using the
‘MapDrive() and MapPrinter() functions alone.
‘—————–
‘declare global variables here
Option Explicit

Dim oShell, oNet, oFSO, oWshNetwork, oGroupDict

‘—————–
‘Objects go here

Set oShell = CreateObject(“Wscript.Shell”)
Set oNet = CreateObject(“Wscript.Network”)
set oFSO = CreateObject(“Scripting.FileSystemObject”)

‘—————————————————-
‘all mapping and stuff is done from’here
‘you should not have to change functions
‘unless they do not work for some’reason

‘Greeting()

If IsMember(“Directie”) Then
MapDrive “I:”, “\\NFLSVR01”, “\DIRECTIE$”
End If

If IsMember(“JZ”) Then
MapDrive “J:”, “\\NFLSVR01”, “\JUZA$”
End If

If IsMember(“Dossiers”) Then
MapDrive “K:”, “\\NFLSVR01”, “\DOSSIERS$”
End If

‘this is the end of the function calls
‘—————————————-
‘display greeting to the user
Function Greeting()
Dim sTime, sDate, sMessage, sAdsPath, GreetingTime, oUser

sTime = Hour(Now)
sDate = Now

If sTime <= 11 Then GreetingTime = "Morgen" ElseIf sTime <= 18 Then GreetingTime = "Middag" Else GreetingTime = "Avond" End If sMessage = VbCrLf & sDate & VbCrLf & VbCrLf sMessage = sMessage & "Goede " & GreetingTime & " " & oNet.UserName & "," sMessage = sMessage & VbCrLf Wscript.Echo(sM

This discussion is locked

All Comments