Skip to content

Commit 11ec3ed

Browse files
authored
Add files via upload
1 parent 68361a6 commit 11ec3ed

5 files changed

+1121
-0
lines changed

ASREPRoast.ps1

+916
Large diffs are not rendered by default.

FPipe

13 KB
Binary file not shown.

Get-ExchangeServerVersionInfo.ps1

+172
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
<#
2+
.SYNOPSIS
3+
Get Exchange Server schema and version related information for an exisiting Exchange Organization
4+
5+
Thomas Stensitzki
6+
7+
THIS CODE IS MADE AVAILABLE AS IS, WITHOUT WARRANTY OF ANY KIND. THE ENTIRE
8+
RISK OF THE USE OR THE RESULTS FROM THE USE OF THIS CODE REMAINS WITH THE USER.
9+
10+
Version 1.0, 2018-05-22
11+
12+
.DESCRIPTION
13+
14+
This script gets the Exchange schema version from the Active Directory schema partition
15+
16+
The Exchange organization name is fetched from Active Directory automatically
17+
18+
The script fetches at forest level:
19+
- objectVersion of MESO Container
20+
- rangeUpper of ms-Exch-Schema-Version-Pt
21+
- msExchProductId of Exchange Organization container
22+
- objectVersion of Exchange Organization container
23+
24+
The script fetches at forest level:
25+
- objectVersion of MESO Container
26+
27+
.LINK
28+
http://scripts.granikos.eu
29+
30+
.NOTES
31+
Requirements
32+
- Windows Server 2012 R2, Windows Server 2016
33+
34+
Revision History
35+
--------------------------------------------------------------------------------
36+
1.0 Initial release
37+
38+
.EXAMPLE
39+
Fetch all version information in the Active Directory forest
40+
.\Get-ExchangeServerVersionInfo.ps1
41+
#>
42+
[CmdletBinding()]
43+
param(
44+
)
45+
46+
Import-Module -Name ActiveDirectory
47+
48+
#region Functions
49+
50+
function Get-ExchangeOrganizationName {
51+
<#
52+
.SYNOPSIS
53+
This function fetches Exchange organization name from Active Directory configuration partition
54+
55+
.DESCRIPTION
56+
The function determines the forest root domain and queries the Microsoft Exchange container
57+
in the Active Directory configuration partition to get name of the msExchOrganizationContainer.
58+
#>
59+
60+
# Get Active Directory Forest Distinguihsed Name
61+
$ForestNameDN = Get-ADDomain -Identity (Get-ADDomain).Forest | Select-Object -ExpandProperty DistinguishedName
62+
63+
# Fetch Exchange Services hive from Active Directory Configuration Partition
64+
$Configuration = [ADSI]('LDAP://CN=Microsoft Exchange,CN=Services,CN=Configuration,{0}' -f $ForestNameDN)
65+
66+
# Get Exchange Organization Name from Exchange Services hive
67+
$OrganizationName = ($Configuration.psbase.children | Where-Object {$_.objectClass -eq 'msExchOrganizationContainer'}).Name
68+
69+
return $OrganizationName
70+
71+
}
72+
73+
function Get-ExchangeSchemaVersion {
74+
<#
75+
.SYNOPSIS
76+
This function fetches the rangeUpper value from Exchange schema object ms-Exch-Schema-Version-Pt,CN=Schema
77+
78+
.DESCRIPTION
79+
The function determines the forest root domain and connects to the schema partition to read the
80+
rangeUpper value of the ms-Exch-Schema-Version-Pt object.
81+
#>
82+
83+
# Get Active Directory Forest Distinguished Name
84+
$ForestNameDN = Get-ADDomain -Identity (Get-ADDomain).Forest | Select-Object -ExpandProperty DistinguishedName
85+
86+
# Get rangeUpper attribute
87+
$RangeUpper =([ADSI]('LDAP://CN=ms-Exch-Schema-Version-Pt,CN=Schema,CN=Configuration,{0}' -f $ForestNameDN)).rangeUpper
88+
89+
return $RangeUpper
90+
91+
}
92+
93+
function Get-ExchangeDomainInformation {
94+
<#
95+
.SYNOPSIS
96+
Fetches the objectVersion attribute value of the MESO container object.
97+
Fetches the msExchProductId and objectVersion attributes of Exchange Organization object, if the domain is the forest root domain.
98+
99+
.DESCRIPTION
100+
The script determines whether to domain is the forest root domain. If the domain is the forest root the script fetches the following attributes:
101+
- MESO container objectVersion
102+
- Exchange organization msExchProductId
103+
- Exchange organization objectVersion
104+
105+
If the domain is not the forest root domain, the script fetches the following attribute:
106+
- MESO container objectVersion
107+
108+
.PARAMETER DomainName
109+
The Active Directory domain name of the domain to query
110+
111+
.PARAMETER ExchangeOrganizationName
112+
The Exchange organization name
113+
114+
.EXAMPLE
115+
Get-ExchangeDomainInformation -DomainName varunagroup.de -ExchangeOrganizationName Varuna-Group
116+
Get the Exchange related domain information for Active Directory domain varunagroup.de and Exchange organization named Varuna-Group
117+
#>
118+
119+
param (
120+
[Parameter(Mandatory,HelpMessage='Active Directory Domain Name')][string]$DomainName,
121+
[Parameter(Mandatory,HelpMessage='Provide the Exchange Organization Name')][string]$ExchangeOrganizationName
122+
)
123+
124+
$DomainDN = Get-ADDomain -Identity $DomainName | Select-Object -ExpandProperty DistinguishedName
125+
126+
# Get Active Directory Forest Distinguihsed Name
127+
$ForestNameDN = Get-ADDomain -Identity (Get-ADDomain).Forest | Select-Object -ExpandProperty DistinguishedName
128+
129+
# Get MESO Container object Version
130+
$MESOObjectVersion = ([ADSI]('LDAP://CN=Microsoft Exchange System Objects,{0}' -f $DomainDN)).objectVersion
131+
Write-Host ('MESO Container objectVersion : {0}' -f $($MESOObjectVersion))
132+
133+
if($DomainDN -eq $ForestNameDN) {
134+
135+
# Get Exchange ProductId (Version) of Exchange Organisation
136+
$ConfigurationProductId = ([ADSI]('LDAP://CN={0},CN=Microsoft Exchange,CN=Services,CN=Configuration,{1}' -f $ExchangeOrganizationName, $DomainDN)).msExchProductId
137+
Write-Host ('Exchange Configuration msExchProductId : {0}' -f $($ConfigurationProductId))
138+
139+
# Get Exchange ObjectVersion of Exchange Organisation
140+
$ConfigurationObjectVersion = ([ADSI]('LDAP://CN={0},CN=Microsoft Exchange,CN=Services,CN=Configuration,{1}' -f $ExchangeOrganizationName, $DomainDN)).objectVersion
141+
Write-Host ('Exchange Configuration objectVersion : {0}' -f $($ConfigurationObjectVersion))
142+
143+
}
144+
}
145+
146+
#endregion
147+
148+
## MAIN ##########################################
149+
150+
# Write forest root domain
151+
Write-Host
152+
Write-Host "Exchange Server Schema and Object Information for forest [$((Get-ADForest).Name.ToUpper())]" -ForegroundColor Gray
153+
154+
# Fetch Exchange Organization name
155+
$ExchangeOrgName = Get-ExchangeOrganizationName
156+
Write-Host ('Exchange Organization Name : {0}' -f $ExchangeOrgName)
157+
158+
# Write Exchange schema version
159+
Write-Host ('Active Directory Schema rangeUpper: {0}' -f (Get-ExchangeSchemaVersion))
160+
161+
# Fetch all domains in the forest
162+
$ForestDomains = (Get-ADForest).Domains
163+
164+
foreach($Domain in $ForestDomains) {
165+
166+
Write-Host
167+
Write-Host ('Working on {0}' -f ($Domain.ToUpper()))
168+
169+
# Get domain related information
170+
Get-ExchangeDomainInformation -DomainName $Domain -ExchangeOrganizationName $ExchangeOrgName
171+
172+
}

GetCLSID.ps1

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<#
2+
This script extracts CLSIDs and AppIDs related to LocalService.DESCRIPTION
3+
Then exports to CSV
4+
#>
5+
6+
$ErrorActionPreference = "Stop"
7+
8+
# Importing some requirements
9+
. .\utils\Join-Object.ps1
10+
11+
New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT
12+
13+
$CLSID = Get-ItemProperty HKCR:\clsid\* | select-object AppID,@{N='CLSID'; E={$_.pschildname}} | where-object {$_.appid -ne $null}
14+
15+
$APPID = Get-ItemProperty HKCR:\appid\* | select-object localservice,@{N='AppID'; E={$_.pschildname}} | where-object {$_.LocalService -ne $null}
16+
17+
$RESULT = Join-Object -Left $APPID -Right $CLSID -LeftJoinProperty AppID -RightJoinProperty AppID -Type AllInRight | Sort-Object LocalService
18+
19+
# Preparing to Output
20+
$OS = (Get-WmiObject -Class Win32_OperatingSystem | ForEach-Object -MemberName Caption).Trim() -Replace "Microsoft ", ""
21+
$TARGET = $OS -Replace " ","_"
22+
23+
# Make target folder
24+
New-Item -ItemType Directory -Force -Path .\$TARGET
25+
26+
# Output in a CSV
27+
$RESULT | Export-Csv -Path ".\$TARGET\CLSIDs.csv" -Encoding ascii -NoTypeInformation
28+
29+
# Export CLSIDs list
30+
$RESULT | Select CLSID -ExpandProperty CLSID | Out-File -FilePath ".\$TARGET\CLSID.list" -Encoding ascii
31+
32+
# Visual Table
33+
$RESULT | ogv

cachedump.exe

48 KB
Binary file not shown.

0 commit comments

Comments
 (0)