Question
Export HTML d'un report
- olivierD
- Auteur du sujet
- Hors Ligne
- Nouveau membre
-
Réduire
Plus d'informations
- Messages : 3
- Remerciements reçus 0
il y a 13 ans 10 mois #11634
par olivierD
Export HTML d'un report a été créé par olivierD
Bonjour à tous,
voici ma config :
Ferme ESX/
PowerGUI 3.2 / PowerCLi / PowerShell
A partir de PowerGui Console Administration, je génère un report sur les snapshots de ma ferme ESX. Option \"Generate vReport\".
L'affichage, directement depuis Power GUi, fonctionne à merveille et cela me génère un report HTML (avec CSS).
Cependant, je souhaiterais automatiser cette action. J'ai la possibilité d'exporter le code et de créer un .ps1 sauf que la partie HTML ne suit pas. J'ai juste un fichier brut sans balise html.
Est-ce que vous connaissez un moyen d'avoir exactement ce même rapport automatiquement ? (via les taches planifiés de windows par exemple).
Merci
OD.
voici ma config :
Ferme ESX/
PowerGUI 3.2 / PowerCLi / PowerShell
A partir de PowerGui Console Administration, je génère un report sur les snapshots de ma ferme ESX. Option \"Generate vReport\".
L'affichage, directement depuis Power GUi, fonctionne à merveille et cela me génère un report HTML (avec CSS).
Cependant, je souhaiterais automatiser cette action. J'ai la possibilité d'exporter le code et de créer un .ps1 sauf que la partie HTML ne suit pas. J'ai juste un fichier brut sans balise html.
Est-ce que vous connaissez un moyen d'avoir exactement ce même rapport automatiquement ? (via les taches planifiés de windows par exemple).
Merci
OD.
Connexion ou Créer un compte pour participer à la conversation.
- Richard Lazaro
- Hors Ligne
- Membre platinium
-
Réduire
Plus d'informations
- Messages : 530
- Remerciements reçus 0
il y a 13 ans 10 mois #11635
par Richard Lazaro
Think-MS : (Get-Life).Days | %{ Learn-More }
\\"Problems cannot be solved by the same level of thinking that created them.\\" - Albert Einstein
Réponse de Richard Lazaro sur le sujet Re:Export HTML d'un report
Bonjour,
Pourrais tu donner, le rapport généré par la console d'admin.
Ainsi que le script et le rapport généré par ce script.
Bien Cordialement,
Richard Lazaro.
Pourrais tu donner, le rapport généré par la console d'admin.
Ainsi que le script et le rapport généré par ce script.
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.
- olivierD
- Auteur du sujet
- Hors Ligne
- Nouveau membre
-
Réduire
Plus d'informations
- Messages : 3
- Remerciements reçus 0
il y a 13 ans 10 mois #11636
par olivierD
Réponse de olivierD sur le sujet Re:Export HTML d'un report
Bonjour,
Merci pour ta réponse rapide !
Alors le script généré par PowerGui Console :
[code:1]
#region ****************************** Exécution démarrée - TreeNode: Hosts ******************************
function func_Hosts()
{
$noConnection = $true
if ($defaultVIServers) {
foreach ($managedHost in $defaultVIServers) {
$noConnection = $false
Get-VMHost -Server $managedHost.Name | ForEach-Object {
$_.PSObject.TypeNames.Insert(0,\"$($_.PSObject.TypeNames[0])#VmwarePowerPackExtension\"«»)
$_ `
| Add-Member -MemberType NoteProperty -Name Host -Value $managedHost.Name -PassThru
}
}
}
if ($noConnection) {
Show-MessageBox -Text 'You must connect to one or more vSphere servers before you can manage the hosts on those servers. Please click on the ''Managed Hosts'' node, connect to one or more of the vSphere servers you have configured there, and then try again.' -Caption 'Connection not established' -Buttons 'OK' -Icon 'Information' | Out-Null
}
}
function action()
{
$selectedItemGroups = @($Input `
| Sort-Object -Property Name `
| ForEach-Object {
if (($_.PSObject.TypeNames[0] -eq 'ManagedVMwareHost') -and (-not (Test-VMwareManagementServer -ManagedHost $_))) {
$managedHost = $_
Get-VMHost -Server $managedHost.Connection | ForEach-Object {
$_.PSObject.TypeNames.Insert(0,\"$($_.PSObject.TypeNames[0])#VmwarePowerPackExtension\"«»)
$_ `
| Add-Member -MemberType NoteProperty -Name Host -Value $managedHost.Name -PassThru
}
} else {
$_
}
} `
| Group-Object -Property {if ($_ -eq $null) {'Null'} elseif ($_.PSObject.TypeNames[0] -eq 'ManagedVMwareHost') {'ManagedVMwareHost'} else {$_.GetType().FullName}})
foreach ($group in $selectedItemGroups) {
$selectedItems = $group.Group
if ($selectedItems[0].PSObject.TypeNames -contains 'ManagedVMwareHost') {
$selectedItems = @($selectedItems | ForEach-Object {
$_.Connect()
if ($_.Connected -and (Test-VMwareManagementServer -ManagedHost $_)) {
$_
}
})
}
if (-not $selectedItems) {
continue
}
$selectedItems | Out-VReport
}
}
func_Hosts | where { $_.Name -eq 'xxxxxxxxxxxx'} | action
#endregion ****************************** Exécution terminée - TreeNode: Hosts ******************************
[/code:1]
Par contre, je ne comprends pas les autres choses que tu demandes.
Tu as besoin du resultat HTML ?<br><br>Message édité par: olivierD, à: 24/04/12 17:02
Merci pour ta réponse rapide !
Alors le script généré par PowerGui Console :
[code:1]
#region ****************************** Exécution démarrée - TreeNode: Hosts ******************************
function func_Hosts()
{
$noConnection = $true
if ($defaultVIServers) {
foreach ($managedHost in $defaultVIServers) {
$noConnection = $false
Get-VMHost -Server $managedHost.Name | ForEach-Object {
$_.PSObject.TypeNames.Insert(0,\"$($_.PSObject.TypeNames[0])#VmwarePowerPackExtension\"«»)
$_ `
| Add-Member -MemberType NoteProperty -Name Host -Value $managedHost.Name -PassThru
}
}
}
if ($noConnection) {
Show-MessageBox -Text 'You must connect to one or more vSphere servers before you can manage the hosts on those servers. Please click on the ''Managed Hosts'' node, connect to one or more of the vSphere servers you have configured there, and then try again.' -Caption 'Connection not established' -Buttons 'OK' -Icon 'Information' | Out-Null
}
}
function action()
{
$selectedItemGroups = @($Input `
| Sort-Object -Property Name `
| ForEach-Object {
if (($_.PSObject.TypeNames[0] -eq 'ManagedVMwareHost') -and (-not (Test-VMwareManagementServer -ManagedHost $_))) {
$managedHost = $_
Get-VMHost -Server $managedHost.Connection | ForEach-Object {
$_.PSObject.TypeNames.Insert(0,\"$($_.PSObject.TypeNames[0])#VmwarePowerPackExtension\"«»)
$_ `
| Add-Member -MemberType NoteProperty -Name Host -Value $managedHost.Name -PassThru
}
} else {
$_
}
} `
| Group-Object -Property {if ($_ -eq $null) {'Null'} elseif ($_.PSObject.TypeNames[0] -eq 'ManagedVMwareHost') {'ManagedVMwareHost'} else {$_.GetType().FullName}})
foreach ($group in $selectedItemGroups) {
$selectedItems = $group.Group
if ($selectedItems[0].PSObject.TypeNames -contains 'ManagedVMwareHost') {
$selectedItems = @($selectedItems | ForEach-Object {
$_.Connect()
if ($_.Connected -and (Test-VMwareManagementServer -ManagedHost $_)) {
$_
}
})
}
if (-not $selectedItems) {
continue
}
$selectedItems | Out-VReport
}
}
func_Hosts | where { $_.Name -eq 'xxxxxxxxxxxx'} | action
#endregion ****************************** Exécution terminée - TreeNode: Hosts ******************************
[/code:1]
Par contre, je ne comprends pas les autres choses que tu demandes.
Tu as besoin du resultat HTML ?<br><br>Message édité par: olivierD, à: 24/04/12 17:02
Connexion ou Créer un compte pour participer à la conversation.
- Richard Lazaro
- Hors Ligne
- Membre platinium
-
Réduire
Plus d'informations
- Messages : 530
- Remerciements reçus 0
il y a 13 ans 10 mois #11637
par Richard Lazaro
Think-MS : (Get-Life).Days | %{ Learn-More }
\\"Problems cannot be solved by the same level of thinking that created them.\\" - Albert Einstein
Réponse de Richard Lazaro sur le sujet Re:Export HTML d'un report
Pour voir les différences et comprendre comment regenerer un export identique.
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.
- olivierD
- Auteur du sujet
- Hors Ligne
- Nouveau membre
-
Réduire
Plus d'informations
- Messages : 3
- Remerciements reçus 0
il y a 13 ans 10 mois #11640
par olivierD
Réponse de olivierD sur le sujet Re:Export HTML d'un report
Bonjour,
Est-il possible de vous envoyer le fichier par mp ?
Merci
Est-il possible de vous envoyer le fichier par mp ?
Merci
Connexion ou Créer un compte pour participer à la conversation.
Temps de génération de la page : 0.079 secondes
- Vous êtes ici :
-
Accueil
-
forum
-
PowerShell
-
Discussions générales
- Export HTML d'un report