Skip to content

Commit bb17f75

Browse files
authored
Merge pull request #32 from CriticalSolutionsNetwork/31-add-check-and-import-for-activedirectory-module
fix: Comment Help
2 parents 87a9bf1 + b3ef8ee commit bb17f75

9 files changed

+78
-78
lines changed

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
55

66
## [Unreleased]
77

8+
### Fixed
9+
10+
- Comment-Based help
11+
12+
## [1.9.6] - 2022-12-08
13+
814
### Added
915

1016
- Feature Added: Function `ADDSAssetInventoryAudit` with reporting.

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Get-ADDSActiveAccountAudit [-Clean] [<CommonParameters>]
3939
| <nobr>ApiToken</nobr> | | Private Function Key. | true | true \\(ByPropertyName\\) | |
4040
| <nobr>FTPHost</nobr> | | SFTP Hostname. | true | true \\(ByPropertyName\\) | |
4141
| <nobr>SshHostKeyFingerprint</nobr> | | Adds parameters for sending Audit Report via SFTP. | true | true \\(ByPropertyName\\) | |
42-
| <nobr>RemotePath</nobr> | | Remove FTP path. Will be created in the user path under functionname folder if not specified. | false | true \\(ByPropertyName\\) | \\("./" \\+ $\\($MyInvocation.MyCommand.Name -replace '\\..\\*'\\)\\) |
42+
| <nobr>RemotePath</nobr> | | Remove FTP path. Will be created in the user path under functionname folder if not specified. | false | true \\(ByPropertyName\\) | \\("./" \+ $\\($MyInvocation.MyCommand.Name -replace '\\..\\*'\\)\\) |
4343
| <nobr>Clean</nobr> | | Remove installed modules during run. Remove local files if not a LocalDisk run. | true | false | False |
4444
### Note
4545
Can take password as input into secure string using \\(Read-Host -AsSecureString\\).
@@ -163,7 +163,7 @@ Get-ADDSDepartedUsersAccountAudit [-Clean] [<CommonParameters>]
163163
| <nobr>ApiToken</nobr> | | Private Function Key. | true | true \\(ByPropertyName\\) | |
164164
| <nobr>FTPHost</nobr> | | | true | true \\(ByPropertyName\\) | |
165165
| <nobr>SshHostKeyFingerprint</nobr> | | | true | true \\(ByPropertyName\\) | |
166-
| <nobr>RemotePath</nobr> | | | false | true \\(ByPropertyName\\) | \\("./" \\+ $\\($MyInvocation.MyCommand.Name -replace '\\..\\*'\\)\\) |
166+
| <nobr>RemotePath</nobr> | | | false | true \\(ByPropertyName\\) | \\("./" \+ $\\($MyInvocation.MyCommand.Name -replace '\\..\\*'\\)\\) |
167167
| <nobr>Clean</nobr> | | Remove installed modules during run. Remove local files if not a LocalDisk run. | true | false | False |
168168
| <nobr>WildCardIdentifier</nobr> | | Name wildcard appended to user account. | true | true \\(ByPropertyName\\) | |
169169
### Note
@@ -238,7 +238,7 @@ Get-ADDSPrivilegedAccountAudit [-Clean] [<CommonParameters>]
238238
| <nobr>ApiToken</nobr> | | Private Function Key. | true | true \\(ByPropertyName\\) | |
239239
| <nobr>FTPHost</nobr> | | SFTP Hostname. | true | true \\(ByPropertyName\\) | |
240240
| <nobr>SshHostKeyFingerprint</nobr> | | Adds parameters for sending Audit Report via SFTP. | true | true \\(ByPropertyName\\) | |
241-
| <nobr>RemotePath</nobr> | | Remove FTP path. Will be created in the user path under functionname folder if not specified. | false | true \\(ByPropertyName\\) | \\("./" \\+ $\\($MyInvocation.MyCommand.Name -replace '\\..\\*'\\)\\) |
241+
| <nobr>RemotePath</nobr> | | Remove FTP path. Will be created in the user path under functionname folder if not specified. | false | true \\(ByPropertyName\\) | \\("./" \+ $\\($MyInvocation.MyCommand.Name -replace '\\..\\*'\\)\\) |
242242
| <nobr>Clean</nobr> | | Remove installed modules during run. Remove local files if not a LocalDisk run. | true | false | False |
243243
### Note
244244
Can take password as input into secure string using \\(Read-Host -AsSecureString\\).
@@ -317,7 +317,7 @@ Get-NetworkScan [[-Ports] <Int32[]>] [-Computers] <String[]> [-Report] [<CommonP
317317
### Parameters
318318
| Name | Alias | Description | Required? | Pipeline Input | Default Value |
319319
| - | - | - | - | - | - |
320-
| <nobr>Ports</nobr> | | Default ports are: "21", "22", "23", "25", "53", "67", "68", "80", "443", \` "88", "464", "123", "135", "137", "138", "139", \` "445", "389", "636", "514", "587", "1701", \` "3268", "3269", "3389", "5985", "5986" If you want to supply a port, do so as an integer or an array of integers. "22","80","443", etc. | false | true \\(ByPropertyName\\) | |
320+
| <nobr>Ports</nobr> | | Default ports are: "21", "22", "23", "25", "53", "67", "68", "80", "443", \\` "88", "464", "123", "135", "137", "138", "139", \\` "445", "389", "636", "514", "587", "1701", \\` "3268", "3269", "3389", "5985", "5986" If you want to supply a port, do so as an integer or an array of integers. "22","80","443", etc. | false | true \\(ByPropertyName\\) | |
321321
| <nobr>LocalSubnets</nobr> | | | true | true \\(ByPropertyName\\) | False |
322322
| <nobr>Computers</nobr> | | | true | true \\(ByPropertyName\\) | |
323323
| <nobr>Report</nobr> | | Specify this switch if you would like a report generated in C:\\temp. | false | false | False |

docs/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<!--
33
<auto-generated>
44
<synopsis>
5-
This code was generated by a tool. on: 12/08/2022 17:26:21
5+
This code was generated by a tool. on: 12/09/2022 11:45:53
66
</synopsis>
77
<description>
88
If you'd like to regenerate the documentation, please open up powershell and run

source/ADDSAuditTasks.psd1

+4-10
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
RootModule = 'ADDSAuditTasks.psm1'
1313

1414
# Version number of this module.
15-
ModuleVersion = '1.9.5'
15+
ModuleVersion = '1.9.6'
1616

1717
# Supported PSEditions
1818
# CompatiblePSEditions = @()
@@ -69,7 +69,7 @@
6969
# NestedModules = @()
7070

7171
# Functions 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 functions to export.
72-
FunctionsToExport = @('Get-ADDSActiveAccountAudit','Get-ADDSDepartedUsersAccountAudit','Get-ADDSPrivilegedAccountAudit','Get-ADUsersLastLogon','Get-NetworkScan','Switch-SurnameWithGivenName')
72+
FunctionsToExport = @('Get-ADDSActiveAccountAudit','Get-ADDSAssetInventoryAudit','Get-ADDSDepartedUsersAccountAudit','Get-ADDSPrivilegedAccountAudit','Get-ADUsersLastLogon','Get-NetworkScan','Switch-SurnameWithGivenName')
7373

7474
# 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.
7575
CmdletsToExport = @()
@@ -108,17 +108,11 @@
108108
IconUri = 'https://csn-source.s3.us-east-2.amazonaws.com/CSN-Icon.png'
109109

110110
# ReleaseNotes of this module
111-
ReleaseNotes = '## [1.9.5] - 2022-11-29
111+
ReleaseNotes = '## [1.9.6] - 2022-12-08
112112
113113
### Added
114114
115-
- Added telnet to default ports to scan.
116-
- Added OUI lookup.
117-
- Added MACID lookup
118-
119-
### Fixed
120-
121-
- Fixed `[ADAuditUser]` Class Department property.
115+
- Feature Added: Function `ADDSAssetInventoryAudit` with reporting.
122116
123117
'
124118

source/Classes/1.class1.ps1

-59
Original file line numberDiff line numberDiff line change
@@ -67,63 +67,4 @@ class ADAuditAccount {
6767
$this.NeedMailbox = $NeedMailbox
6868
$this.Department = $Department
6969
}
70-
}
71-
class ADComputerAccount {
72-
[string]$ComputerName
73-
[string]$DNSHostName
74-
[string]$IPv4Address
75-
[string]$IPv6Address
76-
[string]$OperatingSystem
77-
[string]$LastLogon
78-
[string]$Created
79-
[string]$Modified
80-
[string]$Description
81-
[string]$OrgUnit
82-
[string]$KerberosEncryptionType
83-
[string]$SPNs
84-
[string]$GroupMemberships #Computername for Group Membership Search
85-
[string]$LastSeen
86-
# Constructor 1
87-
ADComputerAccount(
88-
[string]$ComputerName,
89-
[string]$DNSHostName,
90-
[string]$IPv4Address,
91-
[string]$IPv6Address,
92-
[string]$OperatingSystem,
93-
[long]$LastLogon,
94-
[datetime]$Created,
95-
[string]$Modified,
96-
[string]$Description,
97-
[string]$OrgUnit,
98-
[Microsoft.ActiveDirectory.Management.ADPropertyValueCollection]$KerberosEncryptionType,
99-
[Microsoft.ActiveDirectory.Management.ADPropertyValueCollection]$SPNs,
100-
[string]$GroupMemberships,
101-
[long]$LastSeen
102-
) {
103-
#Begin Contructor 1
104-
$this.ComputerName = $ComputerName
105-
$this.DNSHostName = $DNSHostName
106-
$this.IPv4Address = $IPv4Address
107-
$this.IPv6Address = $IPv6Address
108-
$this.OperatingSystem = $OperatingSystem
109-
$this.LastLogon = ([DateTime]::FromFileTime($LastLogon))
110-
$this.Created = $Created
111-
$this.Modified = $Modified
112-
$this.Description = $Description
113-
$this.OrgUnit = $(($OrgUnit -replace '^.*?,(?=[A-Z]{2}=)') -replace ",", ">")
114-
$this.KerberosEncryptionType = $(($KerberosEncryptionType | Select-Object -ExpandProperty $_) -replace ", ", " | ")
115-
$this.SPNs = $($SPNs -join " | " )
116-
$this.GroupMemberships = $(Get-ADComputerGroupMemberof -SamAccountName $GroupMemberships)
117-
$this.LastSeen = $(
118-
switch (([DateTime]::FromFileTime($LastSeen))) {
119-
# Over 90 Days
120-
{ ($_ -lt (Get-Date).Adddays( - (90))) } { '3+ months'; break }
121-
# Over 60 Days
122-
{ ($_ -lt (Get-Date).Adddays( - (60))) } { '2+ months'; break }
123-
# Over 90 Days
124-
{ ($_ -lt (Get-Date).Adddays( - (30))) } { '1+ month'; break }
125-
default { 'Recently' }
126-
} # End Switch
127-
) # End LastSeen
128-
}# End Constuctor 1
12970
}

source/Classes/2.class2.ps1

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
class ADComputerAccount {
2+
[string]$ComputerName
3+
[string]$DNSHostName
4+
[string]$IPv4Address
5+
[string]$IPv6Address
6+
[string]$OperatingSystem
7+
[string]$LastLogon
8+
[string]$Created
9+
[string]$Modified
10+
[string]$Description
11+
[string]$OrgUnit
12+
[string]$KerberosEncryptionType
13+
[string]$SPNs
14+
[string]$GroupMemberships #Computername for Group Membership Search
15+
[string]$LastSeen
16+
# Constructor 1
17+
ADComputerAccount(
18+
[string]$ComputerName,
19+
[string]$DNSHostName,
20+
[string]$IPv4Address,
21+
[string]$IPv6Address,
22+
[string]$OperatingSystem,
23+
[long]$LastLogon,
24+
[datetime]$Created,
25+
[string]$Modified,
26+
[string]$Description,
27+
[string]$OrgUnit,
28+
[Microsoft.ActiveDirectory.Management.ADPropertyValueCollection]$KerberosEncryptionType,
29+
[Microsoft.ActiveDirectory.Management.ADPropertyValueCollection]$SPNs,
30+
[string]$GroupMemberships,
31+
[long]$LastSeen
32+
) {
33+
#Begin Contructor 1
34+
$this.ComputerName = $ComputerName
35+
$this.DNSHostName = $DNSHostName
36+
$this.IPv4Address = $IPv4Address
37+
$this.IPv6Address = $IPv6Address
38+
$this.OperatingSystem = $OperatingSystem
39+
$this.LastLogon = ([DateTime]::FromFileTime($LastLogon))
40+
$this.Created = $Created
41+
$this.Modified = $Modified
42+
$this.Description = $Description
43+
$this.OrgUnit = $(($OrgUnit -replace '^.*?,(?=[A-Z]{2}=)') -replace ",", ">")
44+
$this.KerberosEncryptionType = $(($KerberosEncryptionType | Select-Object -ExpandProperty $_) -replace ", ", " | ")
45+
$this.SPNs = $($SPNs -join " | " )
46+
$this.GroupMemberships = $(Get-ADComputerGroupMemberof -SamAccountName $GroupMemberships)
47+
$this.LastSeen = $(
48+
switch (([DateTime]::FromFileTime($LastSeen))) {
49+
# Over 90 Days
50+
{ ($_ -lt (Get-Date).Adddays( - (90))) } { '3+ months'; break }
51+
# Over 60 Days
52+
{ ($_ -lt (Get-Date).Adddays( - (60))) } { '2+ months'; break }
53+
# Over 90 Days
54+
{ ($_ -lt (Get-Date).Adddays( - (30))) } { '1+ month'; break }
55+
default { 'Recently' }
56+
} # End Switch
57+
) # End LastSeen
58+
}# End Constuctor 1
59+
}

source/Public/Get-ADDSActiveAccountAudit.ps1

+2-2
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ function Get-ADDSActiveAccountAudit {
6666
Remove installed modules during run. Remove local files if not a LocalDisk run.
6767
.NOTES
6868
Can take password as input into secure string using (Read-Host -AsSecureString).
69-
#>
69+
#>
7070
[CmdletBinding(DefaultParameterSetName = 'LocalDisk', HelpURI = "https://criticalsolutionsnetwork.github.io/ADDSAuditTasks/#Get-ADDSActiveAccountAudit")]
7171
param (
7272
[Parameter(
@@ -245,7 +245,7 @@ function Get-ADDSActiveAccountAudit {
245245
Write-TSLog "Searching for users who have not signed in within the last $DaysInactive days, where parameter Enabled = $Enabled"
246246
# Audit Script with export to csv and zip. Paramters for Manager, lastLogonTimestamp and DistinguishedName normalized.
247247
# GetActiveUsers
248-
Get-aduser -Filter { LastLogonTimeStamp -lt $time -and Enabled -eq $Enabled } -Properties `
248+
Get-ADUser -Filter { LastLogonTimeStamp -lt $time -and Enabled -eq $Enabled } -Properties `
249249
samaccountname, GivenName, Surname, Name, UserPrincipalName, lastlogontimestamp, DistinguishedName, `
250250
Title, Enabled, Description, Manager, Department -OutVariable ADExport
251251
$Export = @()

source/Public/Get-ADDSDepartedUsersAccountAudit.ps1

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ function Get-ADDSDepartedUsersAccountAudit {
5555
Remove installed modules during run. Remove local files if not a LocalDisk run.
5656
.NOTES
5757
Can take password as input into secure string using (Read-Host -AsSecureString).
58-
#>
58+
#>
5959
[CmdletBinding(DefaultParameterSetName = 'LocalDisk' , HelpURI = "https://criticalsolutionsnetwork.github.io/ADDSAuditTasks/#Get-ADDSDepartedUsersAccountAudit")]
6060
param (
6161
[Parameter(

source/Public/Get-ADDSPrivilegedAccountAudit.ps1

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ function Get-ADDSPrivilegedAccountAudit {
5959
Remove installed modules during run. Remove local files if not a LocalDisk run.
6060
.NOTES
6161
Can take password as input into secure string using (Read-Host -AsSecureString).
62-
#>
62+
#>
6363
[CmdletBinding(DefaultParameterSetName = 'LocalDisk' , HelpURI = "https://criticalsolutionsnetwork.github.io/ADDSAuditTasks/#Get-ADDSPrivilegedAccountAudit")]
6464
param (
6565
[Parameter(

0 commit comments

Comments
 (0)