Question Poser une ACE (Permission) sur une OU

Plus d'informations
il y a 13 ans 1 mois #9193 par Richard Lazaro
Bonjour,

J'ai besoin de poser des permissions sur une OU, J'ai voulu réutiliser un script vbs appelé depuis PowerShell :

[code:1]
Set objOU = GetObject(strADsPath)
If Err <> 0 Then
' Impossible de récupérer l'objet AD
Exit Function
End If

Set objSD = objOU.Get(\"ntSecurityDescriptor\"«»)
Set objDACL = objSD.DiscretionaryACL

Set objAce = CreateObject(\"AccessControlEntry\"«»)
objAce.Trustee = strTrustee
objAce.AceFlags = CLng(intAceFlags)
objAce.AceType = CLng(intAceType)
objAce.Flags = CLng(intFlags)
objAce.AccessMask = CLng(lngAccessMask)

If strObjType <> \"\" Then
objACE.ObjectType = GetGUID(strObjType)
End If

If strInheritedObjtype <> \"\" Then
objACE.InheritedObjectType = GetGUID(strInheritedObjtype)
End If

objDacl.AddAce objACE
objSD.DiscretionaryAcl = objDacl
objOU.Put \"ntSecurityDescriptor\", Array(objSD)
If Err <> 0 Then
' Impossible d'appliquer la DiscretionaryAcl
Exit Function
End If

objOU.SetInfo
If Err <> 0 Then
' Impossible d'affecter l'Ace
Exit Function
End If
[/code:1]

Mais le ObjOU.SetInfo crash et je ne sais pas pourquoi.

Donc je voudrais savoir si vous connaissez une méthode pour faire la même chsoe en PowerShell sans l'utilisation de tier programme à installer (style Quest), j'aimerais être si possible le moins intrusif sur la machine ou avec le moins de pré-requis ...

Bien Cordialement,
Richard Lazaro.

Think-MS : (Get-Life).Days | %{ Learn-More }

\\"Problems cannot be solved by the same level of thinking that created them.\\" - Albert Einstein

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 13 ans 1 mois #9195 par Jacques Barathon
Peux-tu nous montrer le code PowerShell que tu as produit en traduisant le script VBS ci-dessous ?

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 13 ans 1 mois #9198 par Richard Lazaro
Ben justement, je n'y arrive pas ...
J'ai voulu passer par la classe ActiveDirectoryAccessRule mais je ne retrouve pas toutes mes propriétés :

- [OK] Objet sur lequel mettre l'ACE
- [OK] Objet Trustee
... etc

Le reste est à moitié trouvé mais je trouve pas où mettre mes différents attributs présent dans mon vbs ...

Bien Cordialement,
Richard Lazaro.

Think-MS : (Get-Life).Days | %{ Learn-More }

\\"Problems cannot be solved by the same level of thinking that created them.\\" - Albert Einstein

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 13 ans 1 mois #9199 par Richard Lazaro
PS : ma solution de contournement qui consiste à eppeler le vbs fonctionne ... c'était un problème de restriction du serveur de domaine. Mais c'est un peu crados et j'aimerai tout passer du côté de PowerShell.

Think-MS : (Get-Life).Days | %{ Learn-More }

\\"Problems cannot be solved by the same level of thinking that created them.\\" - Albert Einstein

Connexion ou Créer un compte pour participer à la conversation.

Temps de génération de la page : 0.069 secondes
Propulsé par Kunena