Skip to content

Commit

Permalink
1.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jdhitsolutions committed Apr 7, 2021
1 parent e5d30cf commit e52cf01
Show file tree
Hide file tree
Showing 29 changed files with 1,417 additions and 64 deletions.
9 changes: 5 additions & 4 deletions ADReportingTools.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
RootModule = 'ADReportingTools.psm1'

# Version number of this module.
ModuleVersion = '1.2.0'
ModuleVersion = '1.3.0'

# Supported PSEditions
CompatiblePSEditions = @("Desktop","Core")
Expand Down Expand Up @@ -47,7 +47,7 @@ PowerShellHostVersion = '5.1'
# ProcessorArchitecture = ''

# Modules that must be imported into the global environment prior to importing this module
# RequiredModules = @()
RequiredModules = @("ThreadJob")

# Assemblies that must be loaded prior to importing this module
# RequiredAssemblies = @()
Expand Down Expand Up @@ -77,7 +77,8 @@ FormatsToProcess = @(
'formats\addepartmentmember.format.ps1xml',
'formats\adcomputerreport.format.ps1xml',
'formats\adntds.format.ps1xml',
'formats\adbackup.format.ps1xml'
'formats\adbackup.format.ps1xml',
'formats\admanager.format.ps1xml'
)

# Modules to import as nested modules of the module specified in RootModule/ModuleToProcess
Expand All @@ -88,7 +89,7 @@ FunctionsToExport = 'Show-DomainTree','Get-ADUserAudit','Get-ADSummary','Get-ADF
'Get-ADGroupUser','Get-ADBranch','Get-ADDomainControllerHealth','New-ADDomainReport','Get-ADReportingTools','Get-ADCanonicalUser',
'Get-ADUserCategory','Get-ADGroupReport','Split-DistinguishedName','New-ADChangeReport',
'Get-ADReportingToolsOptions','Set-ADReportingToolsOptions','Get-ADDepartment','Get-ADComputerReport', 'Get-NTDSInfo',
'Get-ADBackupStatus','Open-ADReportingToolsHelp','New-ADGroupReport'
'Get-ADBackupStatus','Open-ADReportingToolsHelp','New-ADGroupReport','Get-ADManager'

# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export.
#CmdletsToExport = ''
Expand Down
50 changes: 26 additions & 24 deletions ADReportingTools.psm1
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@

# dot source functions
Get-ChildItem -path $PSScriptRoot\Functions\*.ps1 |
Foreach-Object {
Get-ChildItem -Path $PSScriptRoot\Functions\*.ps1 |
ForEach-Object {
. $_.FullName
}

#region format and type updates
Update-TypeData -TypeName ADBranchMember -MemberType AliasProperty -MemberName DN -Value DistinguishedName -Force

Update-TypeData -TypeName "ADDomainControllerHealth" -MemberType ScriptProperty -MemberName "ServiceAlert" -Value {
$list = "Stopped","StartPending","StopPending","ContinuePending","PausePending","Paused"
if ($this.services.state.where({$list -contains $_})) {
$list = "Stopped", "StartPending", "StopPending", "ContinuePending", "PausePending", "Paused"
if ($this.services.state.where( { $list -contains $_ })) {
$True
}
Else {
$False
}
} -force
} -Force

#endregion

Expand All @@ -26,7 +26,8 @@ $ADUserReportingConfiguration = Get-Content $PSScriptRoot\configurations\aduser-

#use $([char]0x1b) because it will work in Windows PowerShell and PowerShell 7.

$ADReportingToolsOptions = @{
$ADReportingToolsOptions = [ordered]@{
Note = "Use Get-ADReportingToolsOptions and Set-ADReportingToolsOptions"
DistributionList = "$([char]0x1b)[92m"
Alert = "$([char]0x1b)[91m"
Warning = "$([char]0x1b)[38;5;220m"
Expand All @@ -42,6 +43,7 @@ $ADReportingToolsOptions = @{
ComputerClass = "$([char]0x1b)[30;48;5;50m"
IsDC = "$([char]0x1b)[38;5;155m"
IsServer = "$([char]0x1b)[38;5;50m"
Reset = "$([char]0x1b)[0m"
}

#endregion
Expand All @@ -54,19 +56,19 @@ $newRunspace.ApartmentState = "STA"
$newRunspace.ThreadOptions = "ReuseThread"
[void]$newRunspace.Open()
$Global:ADReportingHash = [hashtable]::Synchronized(@{
Note = "This hashtable is used by the ADReportingTools module. Do not delete."
Departments = @()
Note = "This hashtable is used by the ADReportingTools module. Do not delete."
Departments = @()
DomainControllers = @()
BackupLimit = 3
BackupLimit = 3
}
)
$newRunspace.SessionStateProxy.SetVariable("ADReportingHash", $ADReportingHash)

$psCmd = [PowerShell]::Create()

[void]$pscmd.AddScript( {
#this code will run in the background upon module import. Values will populate
#the synchronized hashtable.
#this code will run in the background upon module import. Values will populate
#the synchronized hashtable.
$global:ADReportingHash.Departments = Get-ADUser -Filter "Department -like '*'" -Properties Department | Select-Object -ExpandProperty Department -Unique | Sort-Object
$global:ADReportingHash.DomainControllers = (Get-ADDomain).ReplicaDirectoryServers

Expand Down Expand Up @@ -115,21 +117,21 @@ Register-ArgumentCompleter -CommandName Get-ADDepartment -ParameterName Departme
}

#Add auto complete for SERVER parameter to these commands
$cmds = 'Get-ADBranch','Get-ADCanonicalUser','Get-ADComputerReport','Get-ADDepartment','Get-ADDomainControllerHealth','Get-ADFSMO','Get-ADGroupR
eport','Get-ADGroupUser','Get-ADSiteDetail','Get-ADSiteSummary','Get-ADSummary','Get-ADUserCategory','New-ADChangeReport','New-ADDomain
Report','New-ADGroupReport','Show-DomainTree','Get-ADAccountAuthorizationGroup','Get-ADAccountResultantPasswordReplicationPolicy','Get-
ADAuthenticationPolicy','Get-ADAuthenticationPolicySilo','Get-ADCentralAccessPolicy','Get-ADCentralAccessRule','Get-ADClaimTransformPol
icy','Get-ADClaimType','Get-ADComputer','Get-ADComputerServiceAccount','Get-ADDefaultDomainPasswordPolicy','Get-ADDomain','Get-ADDomain
Controller','Get-ADDomainControllerPasswordReplicationPolicy','Get-ADDomainControllerPasswordReplicationPolicyUsage','Get-ADFineGrained
PasswordPolicy','Get-ADFineGrainedPasswordPolicySubject','Get-ADForest','Get-ADGroup','Get-ADGroupMember','Get-ADObject','Get-ADOptiona
lFeature','Get-ADOrganizationalUnit','Get-ADPrincipalGroupMembership','Get-ADReplicationAttributeMetadata','Get-ADReplicationConnection
','Get-ADReplicationQueueOperation','Get-ADReplicationSite','Get-ADReplicationSiteLink','Get-ADReplicationSiteLinkBridge','Get-ADReplic
ationSubnet','Get-ADResourceProperty','Get-ADResourcePropertyList','Get-ADResourcePropertyValueType','Get-ADRootDSE','Get-ADServiceAcco
unt','Get-ADTrust','Get-ADUser','Get-ADUserResultantPasswordPolicy'
$cmds = 'Get-ADBranch', 'Get-ADCanonicalUser', 'Get-ADComputerReport', 'Get-ADDepartment', 'Get-ADDomainControllerHealth', 'Get-ADFSMO', 'Get-ADGroupR
eport', 'Get-ADGroupUser', 'Get-ADSiteDetail', 'Get-ADSiteSummary', 'Get-ADSummary', 'Get-ADUserCategory', 'New-ADChangeReport', 'New-ADDomain
Report', 'New-ADGroupReport', 'Show-DomainTree', 'Get-ADAccountAuthorizationGroup', 'Get-ADAccountResultantPasswordReplicationPolicy', 'Get-
ADAuthenticationPolicy', 'Get-ADAuthenticationPolicySilo', 'Get-ADCentralAccessPolicy', 'Get-ADCentralAccessRule', 'Get-ADClaimTransformPol
icy', 'Get-ADClaimType', 'Get-ADComputer', 'Get-ADComputerServiceAccount', 'Get-ADDefaultDomainPasswordPolicy', 'Get-ADDomain', 'Get-ADDomain
Controller', 'Get-ADDomainControllerPasswordReplicationPolicy', 'Get-ADDomainControllerPasswordReplicationPolicyUsage', 'Get-ADFineGrained
PasswordPolicy', 'Get-ADFineGrainedPasswordPolicySubject', 'Get-ADForest', 'Get-ADGroup', 'Get-ADGroupMember', 'Get-ADObject', 'Get-ADOptiona
lFeature', 'Get-ADOrganizationalUnit', 'Get-ADPrincipalGroupMembership', 'Get-ADReplicationAttributeMetadata', 'Get-ADReplicationConnection
', 'Get-ADReplicationQueueOperation', 'Get-ADReplicationSite', 'Get-ADReplicationSiteLink', 'Get-ADReplicationSiteLinkBridge', 'Get-ADReplic
ationSubnet', 'Get-ADResourceProperty', 'Get-ADResourcePropertyList', 'Get-ADResourcePropertyValueType', 'Get-ADRootDSE', 'Get-ADServiceAcco
unt', 'Get-ADTrust', 'Get-ADUser', 'Get-ADUserResultantPasswordPolicy'

foreach ($cmd in $cmds) {

Register-ArgumentCompleter -CommandName $cmd -ParameterName Server -ScriptBlock {
Register-ArgumentCompleter -CommandName $cmd -ParameterName Server -ScriptBlock {
param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter)

$global:ADReportingHash.DomainControllers | Where-Object { $_ -like "$WordToComplete*" } |
Expand All @@ -140,7 +142,7 @@ foreach ($cmd in $cmds) {
}
}

Export-ModuleMember -Variable ADUserReportingConfiguration,ADReportingToolsOptions,ADReportingDepartments
Export-ModuleMember -Variable ADUserReportingConfiguration, ADReportingToolsOptions, ADReportingDepartments

#endregion

Binary file modified ADReportingToolsManual.pdf
Binary file not shown.
11 changes: 11 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@

This is a summary of major changes in the ADReportingTools module since it was released as a 1.0 product.

## 1.3.0

+ Added `ThreadJob` as a required module. ([Issue #25](https://github.com/jdhitsolutions/ADReportingTools/issues/25))
+ Changed `$ADReportingToolsOptions` to an `[ordered]` hashtable and added the ANSI reset sequence at the end. Now, if you look at $ADReportingToolsOptions`, your console will reset.
+ Modified `Get-ADReportingToolsOptions` to filter out keys I'm using for reference information when users access `$ADReportingToolsOptions` directly.
+ Added function `Get-ADManager` and custom format file `admanager.format.ps1xml`.
+ Modified `Get-ADComputerReport` to include `Enabled` and `ManagedBy` properties.
+ Added a table view called `Managed` to `adcomputerreport.format.ps1xml`.
+ Added missing online help links.
+ Updated `README.md`.

## 1.2.0

+ Revised help for `Show-DomainTree` to indicate it must be run in a console session and not the PowerShell ISE. (([Issue #23](https://github.com/jdhitsolutions/ADReportingTools/issues/23)))
Expand Down
31 changes: 28 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,13 +177,21 @@ Distribution groups will be shown in green and member counts of 0 in red. The Ag

![adcomputers](images/ComputerAccount01.png)

### [Get-ADComputerReport](docs/Get-ADComputerReport.md)
#### [Get-ADComputerReport](docs/Get-ADComputerReport.md)

`Get-ADComputerReport` will gather information about computer objects in Active Directory.

![get-adcomputerreport](images/get-adcomputerreport.png)

If you are running in a PowerShell console, domain controllers and member servers will be highlighted with an ANSI sequence. The default behavior is to find all objects. But you can filter on a category of Server or Desktop. The filtering is done based on the operating system value.
If you are running in a PowerShell console, domain controllers and member servers will be highlighted with an ANSI sequence. Disabled computer accounts will be displayed in red. The default command behavior is to find all computer objects. But you can search name or filter on a category of Server or Desktop. The filtering is based on the operating system value.

The associated formatting for this command has several named table views. You should sort on the key property first. You can try commands like this:

```powershell
Get-ADComputerReport | Sort OperatingSystem | Format-Table -view os
Get-ADComputerReport | Sort location | Format-Table -view location
Get-ADComputerReport | Sort ManagedBy | Format-Table -view managed
```

#### [Get-ADDomainControllerHealth](docs/Get-ADDomainControllerHealth.md)

Expand Down Expand Up @@ -270,6 +278,23 @@ The command output also has a second formatted view.

![Get-ADSiteDetail](images/get-adsitedetail.png)

#### [Get-ADManager](docs/Get-ADManager.md)

In Active Directory, you can designate a manager for users and objects. From the manager account's perspective, users are designated as DirectReports, and items such as Computers, Groups, and OrganizationalUnits are referred to as ManagedObjects. `Get-ADManager` is a simple way to get a manager account and view everything that they manage. The default is to get all users and all objects, but you can filter using command parameters.

![direct reports](images/admanager-direct.png)

If you are running in a PowerShell console host, the default output will be colorized with ANSI escape sequences from `$ADReportingToolsOptions`. The following items will be highlighted with color

- Disabled accounts
- Domain controller names
- Member server names
- Universal group scope
- DomainLocal group scope
- Distribution group category

![managed objects](images/admanager-managed.png)

#### [Show-DomainTree](docs/Show-DomainTree.md)

Show-DomainTree will display your domain in a tree view at the console. By default, the function will use color-coded ANSI formatting, assuming your PowerShell console supports it. The default display uses the organizational unit names. Although, you can use the distinguishedname of each branch. If you use -Containers, containers like Users will be included.
Expand Down Expand Up @@ -412,4 +437,4 @@ These are items that I'm dreaming about and may add at some point in the future:

I welcome suggestions, feedback, and comments in the module repository's [Discussion](https://github.com/jdhitsolutions/ADReportingTools/discussions) section.

last updated *2021-03-31 13:24:11Z*
last updated *2021-04-07 12:23:19Z*
5 changes: 3 additions & 2 deletions docs/Get-ADBackupStatus.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
external help file: ADReportingTools-help.xml
Module Name: ADReportingTools
online version:
online version: http://bit.ly/3fPV1AE
schema: 2.0.0
---

Expand All @@ -14,7 +14,8 @@ Get an Active Directory backup status
## SYNTAX

```yaml
Get-ADBackupStatus [-DomainController] <String[]> [-Credential <PSCredential>] [<CommonParameters>]
Get-ADBackupStatus [-DomainController] <String[]> [-Credential <PSCredential>]
[<CommonParameters>]
```

## DESCRIPTION
Expand Down
3 changes: 2 additions & 1 deletion docs/Get-ADBranch.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ Get a listing of members in an AD branch.
## SYNTAX

```yaml
Get-ADBranch [-SearchBase] <String> [-ObjectClass <String[]>] [-IncludeDeletedObjects] [-ExcludeContainers] [-Server <String>]
Get-ADBranch [-SearchBase] <String> [-ObjectClass <String[]>]
[-IncludeDeletedObjects] [-ExcludeContainers] [-Server <String>]
[-Credential <PSCredential>] [<CommonParameters>]
```

Expand Down
4 changes: 3 additions & 1 deletion docs/Get-ADCanonicalUser.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ Get an AD user account using a canonical name.
## SYNTAX

```yaml
Get-ADCanonicalUser [-Name] <String> [-Properties <String[]>] [-IncludeDeletedObjects] [-Server <String>] [-Credential <PSCredential>] [<CommonParameters>]
Get-ADCanonicalUser [-Name] <String> [-Properties <String[]>]
-IncludeDeletedObjects] [-Server <String>] [-Credential <PSCredential>]
[<CommonParameters>]
```

## DESCRIPTION
Expand Down
9 changes: 7 additions & 2 deletions docs/Get-ADComputerReport.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
external help file: ADReportingTools-help.xml
Module Name: ADReportingTools
online version:
online version: https://bit.ly/3dFHB7E
schema: 2.0.0
---

Expand All @@ -14,7 +14,8 @@ Get AD Computer account information
## SYNTAX

```yaml
Get-ADComputerReport [[-Name] <String>] [-Category <String>] [-Location <String>] [-SearchBase <String>] [-Server <String>]
Get-ADComputerReport [[-Name] <String>] [-Category <String>]
[-Location <String>] [-SearchBase <String>] [-Server <String>]
[-Credential <PSCredential>] [<CommonParameters>]
```

Expand Down Expand Up @@ -182,3 +183,7 @@ Learn more about PowerShell: http://jdhitsolutions.com/blog/essential-powershell
## RELATED LINKS
[Get-ADDomainControllerHealth](Get-ADDomainControllerHealth.md)
[Get-ADManager](Get-ADManager.md)
[Get-ADComputer]()
7 changes: 5 additions & 2 deletions docs/Get-ADGroupReport.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
external help file: ADReportingTools-help.xml
Module Name: ADReportingTools
online version:
online version: https://bit.ly/3dBUcZq
schema: 2.0.0
---

Expand All @@ -15,7 +15,8 @@ Create a custom group report

```yaml
Get-ADGroupReport [[-Name] <String>] [-SearchBase <String>][-Category <String>]
[-Scope <String>] [-ExcludeBuiltIn] [-Server <String>] [-Credential <PSCredential>] [<CommonParameters>]
[-Scope <String>] [-ExcludeBuiltIn] [-Server <String>]
[-Credential <PSCredential>] [<CommonParameters>]
```

## DESCRIPTION
Expand Down Expand Up @@ -237,3 +238,5 @@ Learn more about PowerShell: http://jdhitsolutions.com/blog/essential-powershell
[Get-ADGroup]()
[Get-ADGroupMember]()
[Get-ADManager](Get-ADManager.md)
Loading

0 comments on commit e52cf01

Please sign in to comment.