LuckyDuck528
Programmer
Hello-
I normally ask for help in the VBScript forum but I think this might be a better place for this question. Please let me know if you know of a better place to ask it...
I created a Master script that runs on my PC. It maps drives to different servers and runs another script (also from my PC) on the server.
Part of what the second script does is to find a particular folder, get the security group names and then get the names of all of the users that belong to that group.
The program works perfectly until it has to Get the security object. Since the program works fine if it is being run on the actual server itself.
I guess I need to know if anyone thinks it is possible to have it somehow say "go to mapped drive S: and get this security for this path"... any ideas on how to fix this would be appreciated! If you need more code or information let me know!
Thanks for your time! I sincerely appreciate it!
I normally ask for help in the VBScript forum but I think this might be a better place for this question. Please let me know if you know of a better place to ask it...
I created a Master script that runs on my PC. It maps drives to different servers and runs another script (also from my PC) on the server.
Part of what the second script does is to find a particular folder, get the security group names and then get the names of all of the users that belong to that group.
The program works perfectly until it has to Get the security object. Since the program works fine if it is being run on the actual server itself.
I guess I need to know if anyone thinks it is possible to have it somehow say "go to mapped drive S: and get this security for this path"... any ideas on how to fix this would be appreciated! If you need more code or information let me know!
Thanks for your time! I sincerely appreciate it!
Code:
Function FindUsers(SubFolder)
[COLOR=green]
Wscript.Echo SubFolder.Path
'I put this in to check that it's looking for the
'right folder, which it is.
[/color]
Set RootDSE = GetObject("LDAP://rootDSE")
Domain = RootDSE.Get("DefaultNamingContext")
Set ObjConnection = CreateObject("ADODB.Connection")
ObjConnection.Open "Provider=ADsDSOObject;"
Set ObjCommand = CreateObject("ADODB.Command")
ObjCommand.ActiveConnection = ObjConnection
[COLOR=red]
Set ObjSecurity = GetObject("winmgmts:\\" & ServerName & "\root\cimv2:Win32_LogicalFileSecuritySetting='" & SubFolder.Path & "'")
[/color]
ObjSecurity.GetSecurityDescriptor ObjSD
Set ObjOwner = ObjSD.Owner
For Each ObjACE In ObjSD.DACL
Permissions = "Special"
If ObjACE.AccessMask = 2032127 Then Permissions = "Full"