Skip to content

Add Description

oliwex edited this page Dec 5, 2021 · 4 revisions
function Add-Description 
{
    Param(
        [Parameter(Mandatory = $true)]
        [Alias("DescriptionPath")]
        $pathToDescription,
        [ValidateSet("Organisational Unit", "Group", "User", "GPOPolicy", "FineGrainedPasswordPolicy","Computer")]
        [String] $descriptionType
    )

    $descriptionFileContent = Get-Content $pathToDescription | ConvertFrom-Json
    $descriptionObject=$null
    if ($descriptionType -like "Organisational Unit")
    {
        $descriptionObject=$descriptionFileContent[0].Elements.PSObject.Properties | ForEach-Object {
        "$($_.Name) - $($_.Value)"
        }
    }
    elseif ($descriptionType -like "Group") {
        $descriptionObject = $descriptionFileContent[1].Elements.PSObject.Properties | ForEach-Object {
            "$($_.Name) - $($_.Value)"
        }
    }
    elseif ($descriptionType -like "User") {
        $descriptionObject = $descriptionFileContent[2].Elements.PSObject.Properties | ForEach-Object {
            "$($_.Name) - $($_.Value)"
        }
    }
    elseif ($descriptionType -like "GPOPolicy") {
        $descriptionObject = $descriptionFileContent[3].Elements.PSObject.Properties | ForEach-Object {
            "$($_.Name) - $($_.Value)"
        }
    }
    elseif ($descriptionType -like "FineGrainedPasswordPolicy") {
        $descriptionObject = $descriptionFileContent[4].Elements.PSObject.Properties | ForEach-Object {
            "$($_.Name) - $($_.Value)"
        }
    }
    elseif ($descriptionType -like "Computer") {
        $descriptionObject = $descriptionFileContent[5].Elements.PSObject.Properties | ForEach-Object {
            "$($_.Name) - $($_.Value)"
        }
    }
    Add-WordList -WordDocument $reportFile -ListType Bulleted -ListData $descriptionObject -Supress $true -Verbose

}
  • Type - Private
  • Input
    • $pathToDescription - path to file where there is information about Active Directory Attributes
    • $descriptionType - name of section where the description for this section exists
  • Output - Description of section
Clone this wiki locally