question

Greg Kiker avatar image
Greg Kiker asked

Add user to an Active Directory security group using an UPDATE trigger

Can I, on an update trigger, add a user to an Active Directory security group? Please help with the T-sql. It is beyond my skills, but the need is there! thanks.

securitytriggeradministration
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Raj More avatar image
Raj More answered

One way you could do this is by running WMI scripts through XPCmdShell in your trigger.

Read more on the WMI script here:

http://gallery.technet.microsoft.com/ScriptCenter/en-us/b9c5914e-86cc-4b2b-8b7d-6a82ab2b465d

There are multiple issues with this, though:

  1. It will make your Updates slower because now you have to shell out, then open a trigger
  2. In most well set up SQL Server environments XPCmdShell is disabled because opens up security holes - Good luck on getting your DBA to open that one up for you.
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.