Tag:GenerateSDDL

  • Generate SDDL function of VBSCript (permission setting)

    Time:2019-8-19

    Copy codeThe code is as follows: Function GenerateSDDL(AccountName, AccessFlag, AccessType, AccessMask) Dim Accounts, ObjWMI, ObjSID, ObjTru, ObjACE Const SET_DACL_PRESENT = &H8004  Set ObjWMI = GetObject(“winmgmts:” & “{impersonationLevel=impersonate, (Security)}!\\.\root\cimv2”)  Set Accounts = ObjWMI.ExecQuery(“SELECT * FROM Win32_Account WHERE Name=’” & AccountName & “‘”) For Each Account In Accounts  StrSID = Account.SID Next Set ObjSID = ObjWMI.Get(“Win32_SID.SID=’”& StrSID &”‘”)  Set ObjTru = ObjWMI.Get(“Win32_Trustee”).SpawnInstance_() ObjTru.Domain  = ObjSID.ReferencedDomainName ObjTru.Name   = […]