Skip to content
This repository was archived by the owner on Apr 12, 2022. It is now read-only.
This repository was archived by the owner on Apr 12, 2022. It is now read-only.

Generating charts for dynamic data not working #64

@oliwex

Description

@oliwex

function Get-GPOPolicy
{
$groupPolicies = Get-GPO -Domain $($Env:USERDNSDOMAIN) -All

foreach ($gpo in $groupPolicies) 
{
    [xml]$xmlGPOReport = $gpo.generatereport('xml')
    #GPO version
    if (($xmlGPOReport.GPO.Computer.VersionDirectory -eq 0) -and ($xmlGPOReport.GPO.Computer.VersionSysvol -eq 0)) 
    {
        $computerSettings = "NeverModified"
    } 
    else 
    {
        $computerSettings = "Modified"
    }
    if (($xmlGPOReport.GPO.User.VersionDirectory -eq 0) -and ($xmlGPOReport.GPO.User.VersionSysvol -eq 0))
    {
        $userSettings = "NeverModified"
    } 
    else 
    {
        $userSettings = "Modified"
    }

    #GPO content
    if ($null -eq $xmlGPOReport.GPO.User.ExtensionData) 
    {
        $userSettingsConfigured = $false
    } 
    else 
    {
        $userSettingsConfigured = $true
    }
    if ($null -eq $xmlGPOReport.GPO.Computer.ExtensionData) 
    {
        $computerSettingsConfigured = $false
    } 
    else 
    {
        $computerSettingsConfigured = $true
    }
    #Output
    [PsCustomObject] @{
        'Name'                   = $xmlGPOReport.GPO.Name
        'Links'                  = $xmlGPOReport.GPO.LinksTo | Select-Object -ExpandProperty SOMPath
        'Has Computer Settings'  = $computerSettingsConfigured
        'Has User Settings'      = $userSettingsConfigured
        'User Enabled'           = $xmlGPOReport.GPO.User.Enabled
        'Computer Enabled'       = $xmlGPOReport.GPO.Computer.Enabled
        'Computer Settings'      = $computerSettings
        'User Settings'          = $userSettings
        'Gpo Status'             = $gpo.GpoStatus
        'Creation Time'          = $gpo.CreationTime
        'Modification Time'      = $gpo.ModificationTime
        'WMI Filter'             = $gpo.WmiFilter.name
        'WMI Filter Description' = $gpo.WmiFilter.Description
        'Path'                   = $gpo.Path
        'GUID'                   = $gpo.Id
        'ACLs'                   = $xmlGPOReport.GPO.SecurityDescriptor.Permissions.TrusteePermissions | ForEach-Object -Process {
            New-Object -TypeName PSObject -Property @{
                'User'            = $_.trustee.name.'#Text'
                'Permission Type' = $_.type.PermissionType
                'Inherited'       = $_.Inherited
                'Permissions'     = $_.Standard.GPOGroupedAccessEnum
            }
        }
    }
}

}
$FilePath = "$Env:USERPROFILE\Desktop\PSWriteWord-Example-CreateCharts3.docx"

$WordDocument = New-WordDocument $FilePath

$lamy=Get-GPOPolicy
foreach($lama in $lamy)
{

$seria = Add-WordChartSeries -ChartName 'Seria' -Names 'Seria' -Values $($lama.Links.Count)

}

Add-WordBarChart -WordDocument $WordDocument -ChartName 'My finances'-ChartLegendPosition Bottom -ChartLegendOverlay $false -ChartSeries $seria

#####################################################################################
Idea: MY AD have many GPO and i want to create chart where the value is number of ou where the gpo is pinned.
Problem: I dont because i cannot pass list of WordChart series into Add-WordBarChart, because it accepts only String[].

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions