Question Création d'OU..Problème

Plus d'informations
il y a 12 ans 7 mois #15596 par jean
Réponse de jean sur le sujet Re:Création d'OU..Problème
6ratgus écrit:

jean21 écrit:

Ton code passe tout le temps dans AD indisponible je comprends pas...

C'est ce bout de code qui coince : [code:1]-Filter \"Name -eq `\"$_`\"\"
[/code:1]


quand tu dis \"passe tout le temps...\" tu veux dire que qu'il est tres lent ? ;)
si il s'arrete directement c'est qu'il n'a pas accee a l'AD
commente les lignes try et catch au dessus et en dessous
et donne moi le message d'erreur !


cette partie peut etre optimiser pour les grosses AD ou serveurs un peu lent


Nan ça veut dire qu'il passe par le try a chaque fois que je lance mon code :

L'erreur est celle-ci : Le filtre de recherche n'est pas reconnu

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

Plus d'informations
il y a 12 ans 7 mois #15597 par jean
Réponse de jean sur le sujet Re:Création d'OU..Problème
T'as été très clair merci ; )

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

Plus d'informations
il y a 12 ans 7 mois #15598 par Philippe
Réponse de Philippe sur le sujet Re:Création d'OU..Problème
attention : le fichier csv ne doit pas contenir de ligne vide
sinon y a erreur :blush:

rajoute une ligne avant le get-ADOrganizationalUnit avec : $_
ca va afficher l'OU recherché et peut etre le probleme

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

Plus d'informations
il y a 12 ans 7 mois #15599 par Matthew BETTON
Réponse de Matthew BETTON sur le sujet Re:Création d'OU..Problème
Bonsoir,

6ratgus écrit:

Pour[code:1]$extract1 = @()[/code:1]
creation d'un tableau (de chaine de caractere vide)


Création d'un tableau : oui :)

... de chaine de caractere vide : non.

il s'agit d'un tableau, qui ne contient rien, même pas un élément qui ne sera donc même pas un objet de type String. D'ailleurs, ce tableau peut contenir n'importe quel type d'objet.

[code:1]
PS > $tab = @()
PS > $tab -is [system.array]
True
PS > $tab -eq $null
PS > $tab -is $null
L'opérande droit de « -is » doit être un type.
Au caractère Ligne:1 : 1
+ $tab -is $null
+ ~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation : (:«») [], RuntimeException
+ FullyQualifiedErrorId : IsOperatorRequiresType

PS > $tab | Get-Member
Get-Member : Aucun objet n'a été spécifié à l'applet de commande get-member.
Au caractère Ligne:1 : 8
+ $tab | Get-Member
+ ~~~~~~~~~~
+ CategoryInfo : CloseError : (:«») [Get-Member], InvalidOperationException
+ FullyQualifiedErrorId : NoObjectInGetMember,Microsoft.PowerShell.Commands.GetMemberCommand

PS > $tab[0]
PS > $tab[1]
PS > $tab[10]
PS > $tab += New-Object PSObject -Property @{Name=\"SKYWALKER\";Firstname=\"Luke\"}
PS > $tab | get-member


TypeName : System.Management.Automation.PSCustomObject

Name MemberType Definition
----

Equals Method bool Equals(System.Object obj)
GetHashCode Method int GetHashCode()
GetType Method type GetType()
ToString Method string ToString()
Firstname NoteProperty System.String Firstname=Luke
Name NoteProperty System.String Name=SKYWALKER


PS > $tab += \"string\"
PS > $tab | get-member


TypeName : System.Management.Automation.PSCustomObject

Name MemberType Definition
----

Equals Method bool Equals(System.Object obj)
GetHashCode Method int GetHashCode()
GetType Method type GetType()
ToString Method string ToString()
Firstname NoteProperty System.String Firstname=Luke
Name NoteProperty System.String Name=SKYWALKER


TypeName : System.String

Name MemberType Definition
----

Clone Method System.Object Clone(), System.Object ICloneable.Clone()
CompareTo Method int CompareTo(System.Object value), int CompareTo(string strB«»), int IComparab...
Contains Method bool Contains(string value)
CopyTo Method void CopyTo(int sourceIndex, char[] destination, int destinationIndex, int co...
EndsWith Method bool EndsWith(string value), bool EndsWith(string value, System.StringCompari...
Equals Method bool Equals(System.Object obj), bool Equals(string value), bool Equals(string...
GetEnumerator Method System.CharEnumerator GetEnumerator(), System.Collections.Generic.IEnumerator...
GetHashCode Method int GetHashCode()
GetType Method type GetType()
GetTypeCode Method System.TypeCode GetTypeCode(), System.TypeCode IConvertible.GetTypeCode()
IndexOf Method int IndexOf(char value), int IndexOf(char value, int startIndex), int IndexOf...
IndexOfAny Method int IndexOfAny(char[] anyOf), int IndexOfAny(char[] anyOf, int startIndex), i...
Insert Method string Insert(int startIndex, string value)
IsNormalized Method bool IsNormalized(), bool IsNormalized(System.Text.NormalizationForm normaliz...
LastIndexOf Method int LastIndexOf(char value), int LastIndexOf(char value, int startIndex), int...
LastIndexOfAny Method int LastIndexOfAny(char[] anyOf), int LastIndexOfAny(char[] anyOf, int startI...
Normalize Method string Normalize(), string Normalize(System.Text.NormalizationForm normalizat...
PadLeft Method string PadLeft(int totalWidth), string PadLeft(int totalWidth, char paddingChar)
PadRight Method string PadRight(int totalWidth), string PadRight(int totalWidth, char padding...
Remove Method string Remove(int startIndex, int count), string Remove(int startIndex)
Replace Method string Replace(char oldChar, char newChar), string Replace(string oldValue, s...
Split Method string[] Split(Params char[] separator), string[] Split(char[] separator, int...
StartsWith Method bool StartsWith(string value), bool StartsWith(string value, System.StringCom...
Substring Method string Substring(int startIndex), string Substring(int startIndex, int length)
ToBoolean Method bool IConvertible.ToBoolean(System.IFormatProvider provider)
ToByte Method byte IConvertible.ToByte(System.IFormatProvider provider)
ToChar Method char IConvertible.ToChar(System.IFormatProvider provider)
ToCharArray Method char[] ToCharArray(), char[] ToCharArray(int startIndex, int length)
ToDateTime Method datetime IConvertible.ToDateTime(System.IFormatProvider provider)
ToDecimal Method decimal IConvertible.ToDecimal(System.IFormatProvider provider)
ToDouble Method double IConvertible.ToDouble(System.IFormatProvider provider)
ToInt16 Method int16 IConvertible.ToInt16(System.IFormatProvider provider)
ToInt32 Method int IConvertible.ToInt32(System.IFormatProvider provider)
ToInt64 Method long IConvertible.ToInt64(System.IFormatProvider provider)
ToLower Method string ToLower(), string ToLower(cultureinfo culture)
ToLowerInvariant Method string ToLowerInvariant()
ToSByte Method sbyte IConvertible.ToSByte(System.IFormatProvider provider)
ToSingle Method float IConvertible.ToSingle(System.IFormatProvider provider)
ToString Method string ToString(), string ToString(System.IFormatProvider provider), string I...
ToType Method System.Object IConvertible.ToType(type conversionType, System.IFormatProvider...
ToUInt16 Method uint16 IConvertible.ToUInt16(System.IFormatProvider provider)
ToUInt32 Method uint32 IConvertible.ToUInt32(System.IFormatProvider provider)
ToUInt64 Method uint64 IConvertible.ToUInt64(System.IFormatProvider provider)
ToUpper Method string ToUpper(), string ToUpper(cultureinfo culture)
ToUpperInvariant Method string ToUpperInvariant()
Trim Method string Trim(Params char[] trimChars), string Trim()
TrimEnd Method string TrimEnd(Params char[] trimChars)
TrimStart Method string TrimStart(Params char[] trimChars)
Chars ParameterizedProperty char Chars(int index) {get;}
Length Property int Length {get;}


PS > $tab += 2
PS > $tab | get-member


TypeName : System.Management.Automation.PSCustomObject

Name MemberType Definition
----

Equals Method bool Equals(System.Object obj)
GetHashCode Method int GetHashCode()
GetType Method type GetType()
ToString Method string ToString()
Firstname NoteProperty System.String Firstname=Luke
Name NoteProperty System.String Name=SKYWALKER


TypeName : System.String

Name MemberType Definition
----

Clone Method System.Object Clone(), System.Object ICloneable.Clone()
CompareTo Method int CompareTo(System.Object value), int CompareTo(string strB«»), int IComparab...
Contains Method bool Contains(string value)
CopyTo Method void CopyTo(int sourceIndex, char[] destination, int destinationIndex, int co...
EndsWith Method bool EndsWith(string value), bool EndsWith(string value, System.StringCompari...
Equals Method bool Equals(System.Object obj), bool Equals(string value), bool Equals(string...
GetEnumerator Method System.CharEnumerator GetEnumerator(), System.Collections.Generic.IEnumerator...
GetHashCode Method int GetHashCode()
GetType Method type GetType()
GetTypeCode Method System.TypeCode GetTypeCode(), System.TypeCode IConvertible.GetTypeCode()
IndexOf Method int IndexOf(char value), int IndexOf(char value, int startIndex), int IndexOf...
IndexOfAny Method int IndexOfAny(char[] anyOf), int IndexOfAny(char[] anyOf, int startIndex), i...
Insert Method string Insert(int startIndex, string value)
IsNormalized Method bool IsNormalized(), bool IsNormalized(System.Text.NormalizationForm normaliz...
LastIndexOf Method int LastIndexOf(char value), int LastIndexOf(char value, int startIndex), int...
LastIndexOfAny Method int LastIndexOfAny(char[] anyOf), int LastIndexOfAny(char[] anyOf, int startI...
Normalize Method string Normalize(), string Normalize(System.Text.NormalizationForm normalizat...
PadLeft Method string PadLeft(int totalWidth), string PadLeft(int totalWidth, char paddingChar)
PadRight Method string PadRight(int totalWidth), string PadRight(int totalWidth, char padding...
Remove Method string Remove(int startIndex, int count), string Remove(int startIndex)
Replace Method string Replace(char oldChar, char newChar), string Replace(string oldValue, s...
Split Method string[] Split(Params char[] separator), string[] Split(char[] separator, int...
StartsWith Method bool StartsWith(string value), bool StartsWith(string value, System.StringCom...
Substring Method string Substring(int startIndex), string Substring(int startIndex, int length)
ToBoolean Method bool IConvertible.ToBoolean(System.IFormatProvider provider)
ToByte Method byte IConvertible.ToByte(System.IFormatProvider provider)
ToChar Method char IConvertible.ToChar(System.IFormatProvider provider)
ToCharArray Method char[] ToCharArray(), char[] ToCharArray(int startIndex, int length)
ToDateTime Method datetime IConvertible.ToDateTime(System.IFormatProvider provider)
ToDecimal Method decimal IConvertible.ToDecimal(System.IFormatProvider provider)
ToDouble Method double IConvertible.ToDouble(System.IFormatProvider provider)
ToInt16 Method int16 IConvertible.ToInt16(System.IFormatProvider provider)
ToInt32 Method int IConvertible.ToInt32(System.IFormatProvider provider)
ToInt64 Method long IConvertible.ToInt64(System.IFormatProvider provider)
ToLower Method string ToLower(), string ToLower(cultureinfo culture)
ToLowerInvariant Method string ToLowerInvariant()
ToSByte Method sbyte IConvertible.ToSByte(System.IFormatProvider provider)
ToSingle Method float IConvertible.ToSingle(System.IFormatProvider provider)
ToString Method string ToString(), string ToString(System.IFormatProvider provider), string I...
ToType Method System.Object IConvertible.ToType(type conversionType, System.IFormatProvider...
ToUInt16 Method uint16 IConvertible.ToUInt16(System.IFormatProvider provider)
ToUInt32 Method uint32 IConvertible.ToUInt32(System.IFormatProvider provider)
ToUInt64 Method uint64 IConvertible.ToUInt64(System.IFormatProvider provider)
ToUpper Method string ToUpper(), string ToUpper(cultureinfo culture)
ToUpperInvariant Method string ToUpperInvariant()
Trim Method string Trim(Params char[] trimChars), string Trim()
TrimEnd Method string TrimEnd(Params char[] trimChars)
TrimStart Method string TrimStart(Params char[] trimChars)
Chars ParameterizedProperty char Chars(int index) {get;}
Length Property int Length {get;}


TypeName : System.Int32

Name MemberType Definition
----

CompareTo Method int CompareTo(System.Object value), int CompareTo(int value), int IComparable.CompareTo(Syste...
Equals Method bool Equals(System.Object obj), bool Equals(int obj), bool IEquatable[int].Equals(int other)
GetHashCode Method int GetHashCode()
GetType Method type GetType()
GetTypeCode Method System.TypeCode GetTypeCode(), System.TypeCode IConvertible.GetTypeCode()
ToBoolean Method bool IConvertible.ToBoolean(System.IFormatProvider provider)
ToByte Method byte IConvertible.ToByte(System.IFormatProvider provider)
ToChar Method char IConvertible.ToChar(System.IFormatProvider provider)
ToDateTime Method datetime IConvertible.ToDateTime(System.IFormatProvider provider)
ToDecimal Method decimal IConvertible.ToDecimal(System.IFormatProvider provider)
ToDouble Method double IConvertible.ToDouble(System.IFormatProvider provider)
ToInt16 Method int16 IConvertible.ToInt16(System.IFormatProvider provider)
ToInt32 Method int IConvertible.ToInt32(System.IFormatProvider provider)
ToInt64 Method long IConvertible.ToInt64(System.IFormatProvider provider)
ToSByte Method sbyte IConvertible.ToSByte(System.IFormatProvider provider)
ToSingle Method float IConvertible.ToSingle(System.IFormatProvider provider)
ToString Method string ToString(), string ToString(string format), string ToString(System.IFormatProvider pro...
ToType Method System.Object IConvertible.ToType(type conversionType, System.IFormatProvider provider)
ToUInt16 Method uint16 IConvertible.ToUInt16(System.IFormatProvider provider)
ToUInt32 Method uint32 IConvertible.ToUInt32(System.IFormatProvider provider)
ToUInt64 Method uint64 IConvertible.ToUInt64(System.IFormatProvider provider)
[/code:1]

@ +

Matthew BETTON

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

Plus d'informations
il y a 12 ans 7 mois #15601 par Philippe
Réponse de Philippe sur le sujet Re:Création d'OU..Problème
bonjour Matthew

Merci d'avoir fait cette précision
J’avais consciemment fait l'erreur en parenthèse pourvoir être plus clair dans les explications
Mais j'ai oublié de précisé pourquoi les parenthèses !! :blush:

Désoler jean21 de cet oubli

N’hésité pas à corriger mes erreurs, car je dois en faire<br><br>Message édité par: 6ratgus, à: 14/08/13 09:57

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

Plus d'informations
il y a 12 ans 7 mois #15602 par jean
Réponse de jean sur le sujet Re:Création d'OU..Problème
6ratgus écrit:

attention : le fichier csv ne doit pas contenir de ligne vide
sinon y a erreur :blush:

rajoute une ligne avant le get-ADOrganizationalUnit avec : $_
ca va afficher l'OU recherché et peut etre le probleme


Non il n'y pas de ligne vide dans mon fichier csv pourtant..:/

Toujours la même erreur : le filtre de recherche n'est pas reconnu..Et ça m'affiche rien du tout $_

j'ai l'impression qu'il n'y a rien dans cette variable ($_)..

Dans le for, mon extract est vide, c'est pas normal ?<br><br>Message édité par: jean21, à: 14/08/13 10:05

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

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