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

Generating charts for dynamic data not working #64

Open
oliwex opened this issue Jul 7, 2021 · 0 comments
Open

Generating charts for dynamic data not working #64

oliwex opened this issue Jul 7, 2021 · 0 comments

Comments

@oliwex
Copy link

oliwex commented Jul 7, 2021

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[].

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant