Mensen,
Ik ben een inlog script aan het maken die automatisch net werk schijven en printers uitdeeld aan de gebruikers aan de hand van rechten, ik ben al op weg:
Nu werkt dit stukje niet:
objNetwork.MapNetworkDrive "F:", \\<servername>\Persoonlijk Neptunus\" ??USER?? ,True
Krijg syntaxis fout.
Het is de bedoeling dat bij ??USER?? de map gekoppeld word van de ingelogde user.
ik heb al verscheidene dingen geprobeerd zoals:
"user"
&user&
wie kan mij helpen?
Ik ben een inlog script aan het maken die automatisch net werk schijven en printers uitdeeld aan de gebruikers aan de hand van rechten, ik ben al op weg:
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
| for(i=0;i<4;i++) { .. }
' VBScript logon script program.
'
Option Explicit
Dim objNetwork, objSysInfo, strUserDN
Dim objGroupList, objUser, objFSO
Dim strComputerDN, objComputer
Set objNetwork = CreateObject("Wscript.Network")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objSysInfo = CreateObject("ADSystemInfo")
strUserDN = objSysInfo.userName
strComputerDN = objSysInfo.computerName
' Bind to the user and computer objects with the LDAP provider.
Set objUser = GetObject("LDAP://" & strUserDN)
Set objComputer = GetObject("LDAP://" & strComputerDN)
' Map a network drive if the user is a member of the group.
objNetwork.MapNetworkDrive "F:", \\<servername>\Persoonlijk Neptunus\" ??USER?? ,True
' Clean up.
Set objNetwork = Nothing
Set objFSO = Nothing
Set objSysInfo = Nothing
Set objGroupList = Nothing
Set objUser = Nothing
Set objComputer = Nothing
Function IsMember(objADObject, strGroup)
' Function to test for group membership.
' objGroupList is a dictionary object with global scope.
If IsEmpty(objGroupList) Then
Set objGroupList = CreateObject("Scripting.Dictionary")
End If
If Not objGroupList.Exists(objADObject.sAMAccountName & "\") Then
Call LoadGroups(objADObject, objADObject)
objGroupList(objADObject.sAMAccountName & "\") = True
End If
IsMember = objGroupList.Exists(objADObject.sAMAccountName & "\" _
& strGroup)
End Function
Sub LoadGroups(objPriObject, objADSubObject)
' Recursive subroutine to populate dictionary object objGroupList.
Dim colstrGroups, objGroup, j
objGroupList.CompareMode = vbTextCompare
colstrGroups = objADSubObject.memberOf
If IsEmpty(colstrGroups) Then
Exit Sub
End If
If TypeName(colstrGroups) = "String" Then
Set objGroup = GetObject("LDAP://" & colstrGroups)
If Not objGroupList.Exists(objPriObject.sAMAccountName & "\" _
& objGroup.sAMAccountName) Then
objGroupList(objPriObject.sAMAccountName & "\" _
& objGroup.sAMAccountName) = True
Call LoadGroups(objPriObject, objGroup)
End If
Set objGroup = Nothing
Exit Sub
End If
For j = 0 To UBound(colstrGroups)
Set objGroup = GetObject("LDAP://" & colstrGroups(j))
If Not objGroupList.Exists(objPriObject.sAMAccountName & "\" _
& objGroup.sAMAccountName) Then
objGroupList(objPriObject.sAMAccountName & "\" _
& objGroup.sAMAccountName) = True
Call LoadGroups(objPriObject, objGroup)
End If
Next
Set objGroup = Nothing
End Sub |
Nu werkt dit stukje niet:
objNetwork.MapNetworkDrive "F:", \\<servername>\Persoonlijk Neptunus\" ??USER?? ,True
Krijg syntaxis fout.
Het is de bedoeling dat bij ??USER?? de map gekoppeld word van de ingelogde user.
ik heb al verscheidene dingen geprobeerd zoals:
"user"
&user&
wie kan mij helpen?