imho.ws
IMHO.WS  

Вернуться   IMHO.WS > Компьютеры > Программирование
Опции темы
Старый 31.01.2006, 18:08     # 1
SabbaOff
Newbie
 
Аватар для SabbaOff
 
Регистрация: 20.07.2004
Сообщения: 47

SabbaOff Нуль без палочки
Exclamation Права юзера для доступа к локальной папке на VBScript

Подскажите, плз как на скрипте разрешить доступ юзеру к папке (не шара!)?..
Пример:

Код:
Dim FSO, TheFile, Line, objFSO, objFolder
set FSO=CreateObject("Scripting.FileSystemObject")
set obj=GetObject("LDAP://cn=users,dc=domen,dc=com")
set TheFile= FSO.OpenTextFile("users.txt")
Set objFSO = CreateObject("Scripting.FileSystemObject")

Do while NOT TheFile.AtEndOfStream
Line=TheFile.ReadLine
set usr=obj.Create("user", Line)
usr.SetInfo

usr.setpassword="123456"
usr.SetInfo

Set objFolder = objFSO.CreateFolder("C:\" & Line)

'И вот тут мне нужно пользователю Line
'разрешить доступ на запись/чтение к папке Line

Loop
Help!

Последний раз редактировалось SabbaOff; 31.01.2006 в 18:16.
SabbaOff вне форума  
Старый 01.02.2006, 02:05     # 2
knight
Junior Member
 
Регистрация: 12.09.2004
Сообщения: 106

knight Известность не заставит себя ждатьknight Известность не заставит себя ждать
Посмотрите здесь насколько я помню там об этом шел разговор но не уверен:
http://rsdn.ru/article/com/wscript/WSH.xml?print
knight вне форума  
Старый 01.02.2006, 11:06     # 3
SabbaOff
Newbie
 
Аватар для SabbaOff
 
Регистрация: 20.07.2004
Сообщения: 47

SabbaOff Нуль без палочки
Хорошая статья, правильная...
Но в ней, как и в МСДН, как и в книжке Попова НЕТ ответа на мой вопрос:
КАК ДАТЬ ЮЗЕРУ "Х" ПРАВА НА ЧТЕНИЕ/ЗАПИСЬ ПАПКИ "У"
SabbaOff вне форума  
Старый 13.02.2006, 11:25     # 4
LightImage
Junior Member
 
Регистрация: 16.10.2002
Адрес: Россия-матушка
Пол: Male
Сообщения: 96

LightImage Нимб уже пробиваетсяLightImage Нимб уже пробивается
В MSDN есть такой вот пример:
Код:
' Example Code
' The following VBScript example assumes that a folder named testfolder exists on C:\.
' The script obtains the security for this folder and changes the access permissions
' all the access control entries. For more information on security entities,
' see the Platform SDK section on Security. No error checking or handling is shown.


' The folder named "testfolder" must exist on the C:\ drive.
' Connect to WMI and get the file security object for the testfolder directory
Set wmiFileSecSetting = GetObject ("winmgmts:Win32_LogicalFileSecuritySetting.path='c:\\testfolder'")

' Use the Win32_LogicalFileSecuritySetting Caption property to create a simple header before
' dumping the discretionary access control list (DACL).
Wscript.Echo wmiFileSecSetting.Caption & ":" & vbCrLf

' Call the Win32_LogicalFileSecuritySetting GetSecurityDescriptor
' method to retrieve an instance of the Win32_SecurityDescriptor class
' for the target object, that is, C:\TestFolder. Note that this is achieved by
' passing an empty variable to GetSecurityDescriptor, which
' GetSecurityDescriptor in turn initializes with an instance of the
' Win32_SecurityDescriptor class that corresponds to the security
' descriptor for the target object.
RetVal = wmiFileSecSetting.GetSecurityDescriptor(wmiSecurityDescriptor)

' Retrieve the content of Win32_SecurityDescriptor DACL property.
' The DACL is an array of Win32_ACE objects.
DACL = wmiSecurityDescriptor.DACL

' Display the control flags in the descriptor.
Wscript.Echo "Control Flags:  " & wmiSecurityDescriptor.ControlFlags

' Obtain the trustee for each access control entry (ACE) and change the permissions
' in the AccessMask for each ACE to read, write, and delete.
For each wmiAce in DACL
' Get Win32_Trustee object from ACE 
    Set Trustee = wmiAce.Trustee
    wscript.echo "Trustee Domain: "  & Trustee.Domain
    wscript.echo "Trustee Name: "    & Trustee.Name
    wscript.echo "Access Mask: "     & wmiAce.AccessMask
' Make access for every trustee read (1), write (2), and delete (65536) access
    wmiAce.AccessMask = 65539
    wscript.echo "Access Mask: "     & wmiAce.AccessMask            
Next

' Call the Win32_LogicalFileSecuritySetting.SetSecurityDescriptor method 
' to write the new security descriptor.
RetVal = wmiFileSecSetting.SetSecurityDescriptor(wmiSecurityDescriptor)

Wscript.Echo "ReturnValue is:  " & RetVal
__________________
1 миллибайт = 1/1024 байта
LightImage вне форума  
Старый 13.02.2006, 14:09     # 5
SabbaOff
Newbie
 
Аватар для SabbaOff
 
Регистрация: 20.07.2004
Сообщения: 47

SabbaOff Нуль без палочки
LightImage
Спасибо! Это именно то, что я искал!..
Странно, что сам не смог найти....
SabbaOff вне форума  

Опции темы

Ваши права в разделе
Вы НЕ можете создавать новые темы
Вы не можете отвечать в темах.
Вы НЕ можете прикреплять вложения
Вы НЕ можете редактировать свои сообщения

BB код Вкл.
Смайлы Вкл.
[IMG] код Выкл.
HTML код Выкл.

Быстрый переход


Часовой пояс GMT +4, время: 13:08.




Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.