设为首页收藏本站Access中国

Office中国论坛/Access中国论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

返回列表 发新帖
查看: 4557|回复: 7
打印 上一主题 下一主题

[Access本身] 有办法用.bat或修改注册表的方法修改文件夹的安全权限吗?

[复制链接]
跳转到指定楼层
1#
发表于 2008-7-2 14:38:23 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
我把程序打包了安装,安装在c:\program files\下,因为.mde文件里边有本身的数据表(用作临时表),也有链接的数据表
当sql操作本身的数据表时提示无权修改,我晕,原来是文件夹的安全权限不够,后来把power users,users(我公司用域的)的权限改成完全控制后就没问题了。
有没有一个办法做一个.bat文件自动把安装文件夹的power users,users的权限改成完全控制?
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享分享 分享淘帖 订阅订阅
2#
发表于 2008-7-2 15:38:47 | 只看该作者
使用VBS脚本,应该可以的,参考下面的贴子


http://topic.csdn.net/t/20050713/17/4142376.html
3#
 楼主| 发表于 2008-7-3 16:48:16 | 只看该作者
版主,
那个是文件夹共享使用权限哦,不是文件夹安全权限,因为安装在c:\program files下面的程序都不是everyone,而是分不同用户组来定义权限的!
4#
发表于 2008-7-4 10:13:19 | 只看该作者
我看这代码应该是可以设置文件夹的安全权限的,它设置的是具体的文件夹如'c:\program files',但我不知道那个设置的含义。
那段代码可存为.VBS文件由WSH执行,也可在VBA中运行,只需将输出语句改一下即可

Sub test()
'   Connect   to   WMI   and   get   the   file   security   object   for   the   testfolder   directory
  Set wmiFileSecSetting = GetObject("winmgmts:Win32_LogicalFileSecuritySetting.path='c:\program files'")
   
  '   Use   the   Win32_LogicalFileSecuritySetting   Caption   property   to   create   a   simple   header before
  '   dumping   the   discretionary   access   control   list   (DACL).
'  WScript.Echo wmiFileSecSetting.Caption & ":" & vbCrLf
  MsgBox wmiFileSecSetting.Caption & ":" & vbCrLf
   
  '   Obtain   existing   security   descriptor   for   folder
  RetVal = wmiFileSecSetting.GetSecurityDescriptor(wmiSecurityDescriptor)
  If Err <> 0 Then
'          WScript.Echo "GetSecurityDescriptor   failed" & vbCrLf & Err.Number & vbCrLf & Err.Description
'          WScript.Quit
          MsgBox "GetSecurityDescriptor   failed" & vbCrLf & Err.Number & vbCrLf & Err.Description
          Exit Sub
  Else
'          WScript.Echo "GetSecurityDescriptor   suceeded"
          MsgBox "GetSecurityDescriptor   suceeded"
  End If
   
  '   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.
MsgBox "Control   Flags:     " & wmiSecurityDescriptor.ControlFlags
' 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
          MsgBox "Trustee   Name:   " & Trustee.Name
         MsgBox "Access   Mask:   " & wmiAce.AccessMask
'          WScript.Echo "Trustee   Name:   " & Trustee.Name
'          WScript.Echo "Access   Mask:   " & wmiAce.AccessMask
  '   Set   read   access   to   the   owner,   group,   and   DACL   of   the   security   descriptor (131072)
‘我没弄清这个131072代表的含义,但这个数=2^17
          wmiAce.AccessMask = 16384
         MsgBox "Access   Mask:   " & wmiAce.AccessMask
'          WScript.Echo "Access   Mask:   " & wmiAce.AccessMask
  Next
   
  '   Call   the   Win32_LogicalFileSecuritySetting.SetSecurityDescriptor   method
  '   to   write   the   new   security   descriptor.
  RetVal = wmiFileSecSetting.SetSecurityDescriptor(wmiSecurityDescriptor)
   
  MsgBox "ReturnValue   is:     " & RetVal
'  WScript.Echo "ReturnValue   is:     " & RetVal
End Sub
5#
 楼主| 发表于 2008-7-8 11:06:22 | 只看该作者
谢谢,看看先
6#
发表于 2008-7-8 11:25:35 | 只看该作者
学习了[:33]
7#
发表于 2009-3-21 22:33:40 | 只看该作者
有个命令行工具可以修改ntfs权限的。xcal什么的,一下子忘了。
8#
发表于 2009-5-22 14:59:43 | 只看该作者
应该是没什么问题吧
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|站长邮箱|小黑屋|手机版|Office中国/Access中国 ( 粤ICP备10043721号-1 )  

GMT+8, 2024-4-25 19:14 , Processed in 0.106721 second(s), 31 queries .

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表