Hi all:
I was wondering if anyone can help me figure out why I am getting a
"Permission denied: 'Get Object' " error message when I try to run a
logon script created using vb. Below is a copy of the script. It
seems that I'm getting this error at the very end. Can anyone tell me
exactly where the permissions need to be set and what permissions are
needed? I have the Windows 2003 default permissions and it is still
not working.
Option Explicit ' Force explicit declarations
'
' Variables
'
Dim RCKNetwork
Dim FSO
Dim strUserName ' Current user
Dim strUserDomain ' Current User's domain name
Dim strDFS ' Path to the DFS root
Dim strDepartment ' Current User's Department
Dim strLDrv ' Current user's L: Drive location
Dim strSDrv ' Current user's S: Drive location
Dim ObjGroupDict ' Dictionary of groups to which the user belongs
Dim AllDrives ' A listing of all drives that already exist
Dim MapLDrive ' Used to determine is user will have a L: Drive
Dim i
Set RCKNetwork = CreateObject("WScript.Network")
Set FSO = CreateObject("Scripting.FileSystemObject")
Set AllDrives = RCKNetwork.EnumNetworkDrives()
strUserName = RCKNetwork.UserName
strUserDomain = RCKNetwork.UserDomain
strDFS = "\\RCKDOMAIN\Shares\"
strLDrv = "\\192.168.20.15\" & strUserName
' Read the user's account "Member Of" tab info across the network
' once into a dictionary object.
' Test for L:, Q:, S:, U:, & Z: then delete them if they exist
For i = 0 To AllDrives.Count - 1 Step 2
If AllDrives.Item(i) = "L:" Then RCKNetwork.RemoveNetworkDrive "L:",
True, True
If AllDrives.Item(i) = "P:" Then RCKNetwork.RemoveNetworkDrive "P:",
True, True
If AllDrives.Item(i) = "Q:" Then RCKNetwork.RemoveNetworkDrive "Q:",
True, True
If AllDrives.Item(i) = "S:" Then RCKNetwork.RemoveNetworkDrive "S:",
True, True
If AllDrives.Item(i) = "U:" Then RCKNetwork.RemoveNetworkDrive "U:",
True, True
Next
Set ObjGroupDict = CreateMemberOfObject(strUserDomain, strUserName)
MapLDrive = TRUE
strDepartment = ""
' Admins, do not have an L: drive
If MemberOf(ObjGroupDict, "Domain Admins") Then MapLDrive = FALSE
If MemberOf(ObjGroupDict, "Help Desk Admins") Then MapLDrive = FALSE
' Find Current User's Department
If MemberOf(ObjGroupDict, "Accounting Group") Then strDepartment =
"Accounting"
If MemberOf(ObjGroupDict, "Marketing Group") Then strDepartment =
"Marketing"
If MemberOf(ObjGroupDict, "Finance Group") Then strDepartment =
"Finance"
If MemberOf(ObjGroupDict, "Research Group") Then strDepartment =
"Research"
' Map the S: Drive
strSDrv = strDFS & "Departments\" & strDepartment
If strDepartment <> "" Then RCKNetwork.MapNetworkDrive "S:", strSDr
' Now we will map all Custom Drives
If MemberOf(ObjGroupDict, "Domain Admins") Then
RCKNetwork.MapNetworkDrive "P:", strDFS & "Software\APPS"
If MemberOf(ObjGroupDict, "Help Desk Admins") Then
RCKNetwork.MapNetworkDrive "P:", strDFS & "Software\APPS"
If MemberOf(ObjGroupDict, "Audit Group") Then
RCKNetwork.MapNetworkDrive "Q:", strDFS &
"Departments\Accounting\Audit"
If MemberOf(ObjGroupDict, "Sales Group") Then
RCKNetwork.MapNetworkDrive "Q:", strDFS & "Departments\Marketing\Sales"
If MemberOf(ObjGroupDict, "Proposal Group") Then
RCKNetwork.MapNetworkDrive "T:", strDFS &
"Departments\Finance\Proposals"
If MemberOf(ObjGroupDict, "Development Group") Then
RCKNetwork.MapNetworkDrive "U:", strDFS &
"Departments\Research\Develop"
' Map L: Drive
If MapLDrive = TRUE Then RCKNetwork.MapNetworkDrive "L:", strLDrv
Function MemberOf(ObjDict, strKey)
' Given a Dictionary object containing groups to which the user
' is a member of and a group name, then returns True if the group
' is in the Dictionary else return False.
'
' Inputs:
' strDict - Input, Name of a Dictionary object
' strKey - Input, Value being searched for in
' the Dictionary object
' Sample Usage:
'
' If MemberOf(ObjGroupDict, "DOMAIN ADMINS") Then
' wscript.echo "Is a member of Domain Admins."
' End If
'
'
MemberOf = CBool(ObjGroupDict.Exists(strKey))
End Function
Function CreateMemberOfObject(strUserDomain, strUserName)
' Given a domain name and username, returns a Dictionary
' object of groups to which the user is a member of.
'
' Inputs:
'
' strDomain - Input, NT Domain name
' strUserName - Input, NT username
'
Dim objUser, objGroup
Set CreateMemberOfObject = CreateObject("Scripting.Dictionary")
CreateMemberOfObject.CompareMode = vbTextCompare
Set objUser = GetObject("WinNT://" _
& strDomain & "/" _
& strUserName & ",user")
For Each objGroup In objUser.Groups
CreateMemberOfObject.Add objGroup.Name, "-"
Next
Set objUser = Nothing
I have verified that both authenticated users group and domain users
group the default permissions to include the read and apply policy
permission. Is there something I'm overlooking?
Please assit
thank you
Jerrald Noland
jnoland767@hotmail.com
End Function