Skip to content

Commit 00a4808

Browse files
authored
Merge pull request #22 from CriticalSolutionsNetwork/20-fix-property-order
20 fix property order
2 parents 1ed29c8 + b75498a commit 00a4808

7 files changed

+206
-76
lines changed

CHANGELOG.md

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

66
## [Unreleased]
77

8+
## [1.9.2] - 2022-11-08
9+
10+
### Fixed
11+
12+
- Fixed ordered hashtable in departed users audit.
13+
- Fixed service principal name output.
14+
15+
## [1.9.0] - 2022-11-08
16+
817
### Fixed
918

1019
- Fixed line 36 of `Switch-SurnameWithGivenName` to `$HRCSV = Import-Csv $RosterCSV`

README.md

+49-49
Large diffs are not rendered by default.

ReleaseNotes.md

+113
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
## [1.9.2] - 2022-11-08
2+
3+
### Fixed
4+
5+
- Fixed ordered hashtable in departed users audit.
6+
- Fixed service principal name output.
7+
8+
## [1.9.0] - 2022-11-08
9+
10+
### Fixed
11+
12+
- Fixed line 36 of `Switch-SurnameWithGivenName` to `$HRCSV = Import-Csv $RosterCSV`
13+
14+
## [1.8.0] - 2022-11-08
15+
16+
### Removed
17+
18+
- Removed function `Format-HRRoster` to public functions to format roster for compare.
19+
20+
### Added
21+
22+
- Renamed function `Format-HRRoster` for clarity to `Switch-SurnameWithGivenName`.
23+
- Added `Get-NetworkScan` public function to scan subnets for hosts and open ports.
24+
25+
## [1.6.1] - 2022-07-21
26+
27+
### Added
28+
29+
- Added Name parameter to `Get-ADDSActiveUsersAudit` and `Get-ADDSDepartedUsersAudit`
30+
31+
## [1.5.4] - 2022-07-21
32+
33+
### Fixed
34+
35+
- Fixed Log output of ADDSActiveUserAudit function.
36+
- Fixed Release
37+
38+
## [1.5.0] - 2022-05-16
39+
40+
### Fixed
41+
42+
- Fixed Timestamp unassigned variable.
43+
- Fixed unassigned time variables in public functions.
44+
45+
## [1.4.0] - 2022-05-15
46+
47+
### Fixed
48+
49+
- Fixed output for export in Privileged Account Audit.
50+
51+
## [1.3.0] - 2022-05-15
52+
53+
### Added
54+
55+
- Added FTP submission error handling.
56+
- Added Class `[ADAuditAccount]`
57+
58+
## [1.2.0] - 2022-05-14
59+
60+
### Added
61+
62+
- Added Upload via WinSCP using private function `Submit-FTPUpload`
63+
64+
## [1.1.0] - 2022-05-11
65+
66+
### Added
67+
68+
- Added proper attachment handling with multiple files.
69+
70+
## [1.1.0-preview0001] - 2022-05-11
71+
72+
### Added
73+
74+
- Added proper attachment handling with multiple files.
75+
76+
## [0.7.0] - 2022-05-11
77+
78+
### Added
79+
80+
- Added fixes to zip handling.
81+
82+
## [0.6.5] - 2022-05-11
83+
84+
### Added
85+
86+
- Added extended rights to privileged account audit.
87+
- Added private function `Get-ADExtendedRight`
88+
89+
### Changed
90+
91+
- Changed how extended user rights are obtained.
92+
- Changed CSV and ZIP files names to sort by date.
93+
94+
### Removed
95+
96+
- Removed old method of retrieving AD privileged audit output.
97+
98+
### Fixed
99+
100+
- Fixed `Get-ADDSDepartedUsersAccountAudit` Not requiring wildcard.
101+
- Log output for csv export.
102+
- Log output filename for log file.
103+
104+
### Security
105+
106+
- In case of vulnerabilities.
107+
108+
## [0.6.4] - 2022-05-09
109+
110+
### Fixed
111+
112+
- Fixed unused parameters in public functions.
113+

Unbuild.ps1 buildpak.ps1

+6-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,12 @@ Remove-Item C:\temp\ADDS* -Recurse
1212

1313

1414

15-
15+
# Update Changelog
16+
# Update Manifest from Previous Module
17+
# git tag -a v1.0.0 -m "v1.0.0 Release"
18+
# Build / Test
19+
# Add Api Variables to session.
20+
# Build / Publish
1621

1722
.\build.ps1 -tasks build,pack,publish -CodeCoverageThreshold 0
1823

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: 11/08/2022 16:57:48
5+
This code was generated by a tool. on: 11/08/2022 19:25:50
66
</synopsis>
77
<description>
88
If you'd like to regenerate the documentation, please open up powershell and run

source/ADDSAuditTasks.psd1

+7-6
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.7.1'
15+
ModuleVersion = '1.9.2'
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')
72+
FunctionsToExport = @('Get-ADDSActiveAccountAudit','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,11 +108,12 @@
108108
IconUri = 'https://csn-source.s3.us-east-2.amazonaws.com/CSN-Icon.png'
109109

110110
# ReleaseNotes of this module
111-
ReleaseNotes = '## [1.6.0] - 2022-07-21
111+
ReleaseNotes = '## [1.9.2] - 2022-11-08
112112
113-
### Added
113+
### Fixed
114114
115-
- Added Name parameter to `Get-ADDSActiveUsersAudit` and `Get-ADDSDepartedUsersAudit`
115+
- Fixed ordered hashtable in departed users audit.
116+
- Fixed service principal name output.
116117
117118
'
118119

@@ -126,4 +127,4 @@
126127
# Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix.
127128
# DefaultCommandPrefix = ''
128129

129-
}
130+
}

source/Public/Get-ADDSPrivilegedAccountAudit.ps1

+21-19
Original file line numberDiff line numberDiff line change
@@ -236,8 +236,8 @@ function Get-ADDSPrivilegedAccountAudit {
236236
@{N = 'PriviledgedGroup'; E = { $group } }, `
237237
@{N = 'Enabled'; E = { (Get-ADUser -Identity $_.samaccountname).Enabled } }, `
238238
@{N = 'PasswordNeverExpires'; E = { (Get-ADUser -Identity $_.samaccountname -Properties PasswordNeverExpires).PasswordNeverExpires } }, `
239-
@{N = "LastSign-in"; E = { [DateTime]::FromFileTime((Get-ADUser -Identity $_.samaccountname -Properties lastLogonTimestamp).lastLogonTimestamp) } }, `
240-
@{N = 'LastSeen?'; E = {
239+
@{N = 'LastLogin'; E = { [DateTime]::FromFileTime((Get-ADUser -Identity $_.samaccountname -Properties lastLogonTimestamp).lastLogonTimestamp) } }, `
240+
@{N = 'LastSeen'; E = {
241241
switch ([DateTime]::FromFileTime((Get-ADUser -Identity $_.samaccountname -Properties lastLogonTimestamp).lastLogonTimestamp)) {
242242
# Over 90 Days
243243
{ ($_ -lt $time90) } { '3+ months'; break }
@@ -262,30 +262,31 @@ function Get-ADDSPrivilegedAccountAudit {
262262
} # end else
263263
}
264264
}, # End Named Expression SuspectedSvcAccount
265-
Department, "AccessRequired?", "NeedMailbox?" -OutVariable members | Out-Null
265+
Department, AccessRequired, NeedMailbox -OutVariable members | Out-Null
266266
$ADUsers += $members
267267
}
268268
$Export = @()
269269
# Create $Export Object
270270
foreach ($User in $ADUsers) {
271-
New-Object -TypeName PSCustomObject -Property @{
271+
$hash = [ordered]@{
272+
PriviledgedGroup = $User.PriviledgedGroup
272273
SamAccountName = $User.SamAccountName
273274
Name = $User.Name
274-
PriviledgedGroup = $User.PriviledgedGroup
275-
Enabled = $User.Enabled
276-
PasswordNeverExpires = $User.PasswordNeverExpires
277-
SuspectedSvcAccount = $User.SuspectedSvcAccount
278-
"LastSign-in" = $User."LastSign-in"
279-
"LastSeen?" = $User."LastSeen?"
275+
ObjectClass = $User.ObjectClass
276+
LastLogin = $User.LastLogin
277+
LastSeen = $User.LastSeen
278+
GroupMemberships = $User.GroupMemberships
280279
Title = $User.Title
281280
Manager = $User.Manager
282281
Department = $User.Department
283282
OrgUnit = $User.OrgUnit
284-
"AccessRequired?" = $User."AccessRequired?"
285-
"NeedMailbox?" = $User."NeedMailbox?"
286-
ObjectClass = $User.ObjectClass
287-
GroupMemberships = $User.GroupMemberships
288-
} -OutVariable PSObject | Out-Null
283+
Enabled = $User.Enabled
284+
PasswordNeverExpires = $User.PasswordNeverExpires
285+
SuspectedSvcAccount = $User.SuspectedSvcAccount
286+
AccessRequired = $false
287+
NeedMailbox = $true
288+
}
289+
New-Object -TypeName PSCustomObject -Property $hash -OutVariable PSObject | Out-Null
289290
$Export += $PSObject
290291
}
291292
# Create filenames
@@ -308,10 +309,11 @@ function Get-ADDSPrivilegedAccountAudit {
308309
# Export Delegated access, allowed protocols and Destination Serivces.
309310
$Export3 = Get-ADObject -Filter { (msDS-AllowedToDelegateTo -like '*') -or (UserAccountControl -band 0x0080000) -or (UserAccountControl -band 0x1000000) } `
310311
-prop samAccountName, msDS-AllowedToDelegateTo, servicePrincipalName, userAccountControl | `
311-
Select-Object DistinguishedName, ObjectClass, samAccountName, servicePrincipalName, `
312-
@{name = 'DelegationStatus'; expression = { if ($_.UserAccountControl -band 0x80000) { 'AllServices' }else { 'SpecificServices' } } }, `
313-
@{name = 'AllowedProtocols'; expression = { if ($_.UserAccountControl -band 0x1000000) { 'Any' }else { 'Kerberos' } } }, `
314-
@{name = 'DestinationServices'; expression = { $_.'msDS-AllowedToDelegateTo' } }
312+
Select-Object DistinguishedName, ObjectClass, samAccountName, `
313+
@{N = 'servicePrincipalName'; E = { $_.servicePrincipalName -join " | " } }, `
314+
@{N = 'DelegationStatus'; E = { if ($_.UserAccountControl -band 0x80000) { 'AllServices' }else { 'SpecificServices' } } }, `
315+
@{N = 'AllowedProtocols'; E = { if ($_.UserAccountControl -band 0x1000000) { 'Any' }else { 'Kerberos' } } }, `
316+
@{N = 'DestinationServices'; E = { $_.'msDS-AllowedToDelegateTo' } }
315317
# Try first export.
316318
Export-AuditCSVtoZip -Exported $Export -CSVName $csv -ZipName $zip -ErrorVariable ExportAuditCSVZipErr
317319
# Try second export.

0 commit comments

Comments
 (0)