Question Collection de propriété AD

Plus d'informations
il y a 16 ans 5 mois #5481 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é,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.

Plus d'informations
il y a 16 ans 5 mois #5500 par Laurent Dardenne
Salut,
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
Propulsé par Kunena