1

I have a custom Operating System deployment solution (OSD Upgrade) which as part of the process has to first modify a few associated AD group memberships using the user account of the person who triggers the OSD.

I need to programmatically check (using preferably Vbscript or even PowerShell) if that user has the necessary permissions to modify the group first. If not, I would like to display a message and terminate the OSD process.

Could you please help?

Steve

Steve
  • 111
  • 1

1 Answers1

2

I can't comment yet, but I agree with Ryan Boldger. I did find someone who wrote a module to do just this, but it's quite old. Here's the link if you want to look: https://stackoverflow.com/questions/27069043/how-to-get-effective-permissions-with-powershell-for-an-attribute-on-the-ad-user

It would be far easier to use something like:

try {
  Add-ADGroupMember -Identity <Group Name> -Member <Dummy User> -ErrorAction Stop
  Remove-ADGroupMember -Identity <Group Name> -Member <Dummy User> -ErrorAction Stop
  Write-Host "User has permissions to group <Group Name>"
}
catch {
  throw "User does not have the required access to group <Group Name>"
}
Scott Heath
  • 141
  • 2