Question
Collection de propriété AD
- otokonohito
- Auteur du sujet
- Hors Ligne
- Membre junior
-
Réduire
Plus d'informations
- Messages : 21
- Remerciements reçus 0
il y a 16 ans 5 mois #5481
par otokonohito
Collection de propriété AD a été créé par otokonohito
Bonjour,
je souhaites sortir en HTML le résultat suivant mais je n'y arrive pas.
[code:1]$objDomain = [ADSI]''
$objSearch = New-Object System.DirectoryServices.DirectorySearcher ($objDomain)
$objSearch.Filter = '(&(objectCategory=person)(objectClass=user))'
$objSearch.propertiesToLoad.Add(\"name\"«»)
$objSearch.propertiesToLoad.Add(\"employeeID\"«»)
$result = $objSearch.FindAll()
foreach ($i in $result) {write-host $i.properties.name;$i.properties.employeeID}[/code:1]
Lorsque je fais
[code:1]$result | convertto-html > export.htm[/code:1]
J'obtiens
<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">
<html xmlns=\"www.w3.org/1999/xhtml\">
<head>
<title>HTML TABLE</title>
</head><body>
<table>
<colgroup>
<col/>
<col/>
</colgroup>
<tr><th>Path</th><th>Properties</th></tr>
<tr><td>LDAP://CN=Administrateur,CN=Users,DC=pascal,DC=local</td><td>System.DirectoryServices.ResultPropertyCollection</td></tr>
<tr><td>LDAP://CN=Invit&#233;,CN=Users,DC=pascal,DC=local</td><td>System.DirectoryServices.ResultPropertyCollection</td></tr>
<tr><td>LDAP://CN=krbtgt,CN=Users,DC=pascal,DC=local</td><td>System.DirectoryServices.ResultPropertyCollection</td></tr>
<tr><td>LDAP://CN=test,CN=Users,DC=pascal,DC=local</td><td>System.DirectoryServices.ResultPropertyCollection</td></tr>
</table>
</body></html>
Comment puis-je faire pour afficher ma collection $result?
Merci
je souhaites sortir en HTML le résultat suivant mais je n'y arrive pas.
[code:1]$objDomain = [ADSI]''
$objSearch = New-Object System.DirectoryServices.DirectorySearcher ($objDomain)
$objSearch.Filter = '(&(objectCategory=person)(objectClass=user))'
$objSearch.propertiesToLoad.Add(\"name\"«»)
$objSearch.propertiesToLoad.Add(\"employeeID\"«»)
$result = $objSearch.FindAll()
foreach ($i in $result) {write-host $i.properties.name;$i.properties.employeeID}[/code:1]
Lorsque je fais
[code:1]$result | convertto-html > export.htm[/code:1]
J'obtiens
<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">
<html xmlns=\"www.w3.org/1999/xhtml\">
<head>
<title>HTML TABLE</title>
</head><body>
<table>
<colgroup>
<col/>
<col/>
</colgroup>
<tr><th>Path</th><th>Properties</th></tr>
<tr><td>LDAP://CN=Administrateur,CN=Users,DC=pascal,DC=local</td><td>System.DirectoryServices.ResultPropertyCollection</td></tr>
<tr><td>LDAP://CN=Invit&#233;,CN=Users,DC=pascal,DC=local</td><td>System.DirectoryServices.ResultPropertyCollection</td></tr>
<tr><td>LDAP://CN=krbtgt,CN=Users,DC=pascal,DC=local</td><td>System.DirectoryServices.ResultPropertyCollection</td></tr>
<tr><td>LDAP://CN=test,CN=Users,DC=pascal,DC=local</td><td>System.DirectoryServices.ResultPropertyCollection</td></tr>
</table>
</body></html>
Comment puis-je faire pour afficher ma collection $result?
Merci
Connexion ou Créer un compte pour participer à la conversation.
- Laurent Dardenne
- Hors Ligne
- Modérateur
-
Réduire
Plus d'informations
- Messages : 6311
- Remerciements reçus 68
il y a 16 ans 5 mois #5500
par Laurent Dardenne
Tutoriels PowerShell
Réponse de Laurent Dardenne sur le sujet Re:Collection de propriété AD
Salut,
regarde si Select-Objet -expandproperty peut t'aider :
[code:1]
gps -name \"powershell\"|select processname -expand modules|convertto-html >h.html
[/code:1]
regarde si Select-Objet -expandproperty peut t'aider :
[code:1]
gps -name \"powershell\"|select processname -expand modules|convertto-html >h.html
[/code:1]
Tutoriels PowerShell
Connexion ou Créer un compte pour participer à la conversation.
Temps de génération de la page : 0.040 secondes
- Vous êtes ici :
-
Accueil
-
forum
-
PowerShell
-
Entraide pour les débutants
- Collection de propriété AD