我有下面的脚本,它工作正常,但我如何设置它以保持安全设置并向安全组添加额外的"人"...
...并且可以cacls更改文件夹的"所有者"?
我厌倦/e了编辑而不是替换,但由于某种原因它不喜欢它?
Set WshShell = CreateObject("WScript.Shell")
strFolder = "D:\test"
setPerms = "%COMSPEC% /c echo Y| C:\windows\system32\cacls.exe """ & _
strFolder & """ /G mydomain\myusername:F & pause" 'added pause to see what the outcome is
WshShell.run setPerms
Run Code Online (Sandbox Code Playgroud) 根据主题,是否有命令或甚至可以使用示例VBScript来计算/读取Windows XP和Windows Server 2003操作系统中文件的有效权限?我想要的是能够获得与我在NTFS文件的Security-> Advanced选项的"有效权限"选项卡中看到的相同的信息.
像calcs,icacls等命令不提供有效权限 - 它们可以列出继承权限但不计算有效权限.
编辑 - 基于以下答案,通过使用VB脚本实际上是不可能的.我将编写一段代码,然后从VBScript中调用它
我试图拒绝所有用户能够删除文件夹(如果可能,也包括其内容)。
我目前所拥有的不起作用。
icacls pics /deny Everyone:(OI)(CI)(DE)
Run Code Online (Sandbox Code Playgroud)
使用上面的行既不能保护文件夹也不能保护它的内容,因为我仍然可以删除文件夹和其中的所有文件。
我想使用c#服务阻止来自用户的某些文件夹.这意味着当您启动服务时,虽然它被阻止,但最终结果是阻止文件夹.我写了一个代码.但你的回答是肯定的吗?请帮忙解决这个问题
string Pathname = folder;
EventLog.WriteEntry(Pathname);
string Username = @"BUILTIN\Users";
string UserRights = "N";
if (Pathname == null || Pathname == "")
{
EventLog.WriteEntry("No File");
}
string CommandLine = '"' + System.IO.Path.GetFullPath(Pathname) + '"' + " /C ";
CommandLine += @" /T ";
CommandLine += @" /P " + Username + ":" + UserRights;
Process p = new Process();
p.StartInfo.FileName = "cacls.exe";
p.StartInfo.Arguments = CommandLine;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardInput = true;
p.StartInfo.UseShellExecute = false;
p.StartInfo.WindowStyle = …Run Code Online (Sandbox Code Playgroud) 我需要找出我正在编写的脚本谁是 smb 共享中文件的真正所有者(mount -t cifs当然使用我的服务器安装并net use通过 Windows 机器使用)。
事实证明,在 Linux 服务器上使用 python 查找这些信息确实是一个挑战。
我尝试使用很多 smb 库(例如 smbprotocol、smbclient 等),但没有任何效果。
我发现很少有针对 Windows 的解决方案,它们都使用 pywin32 或其他 Windows 特定的包。
我还设法使用 bash 来做到这一点smbcalcs,但不能干净地做到这一点,但使用subprocess.popen('smbcacls')..
关于如何解决它有什么想法吗?
cacls ×5
command-line ×2
vbscript ×2
.net ×1
batch-file ×1
c# ×1
c#-2.0 ×1
cifs ×1
icacls ×1
linux ×1
ntfs ×1
permissions ×1
python-3.x ×1
service ×1
smb ×1
windows-8 ×1