Featured image of post Documenting with PowerShell: Active Directory domain and settings

Documenting with PowerShell: Active Directory domain and settings

Clients that still have a server on-site are become rare these days – Most of our client base is either completely public cloud using AAD or they have hosted servers in our private cloud. For these clients I’ve made the following script to document their Active Directory server settings. I always I want to be in complete control of my clients environment. That means having up to date documentation at the ready.

Of course there are a stack of other reasons to document the Active Directory environment, think of disaster recovery/runbook scenarios, troubleshooting, possible mergers, or even simply getting a correct overview of the sites, servers, and roles. So, let’s get started! I’ll be posting 2 versions of the script. One for IT-Glue and another for generic use.

IT-Glue version

Warning: Currently my wordpress installation is still replacing < with the HTML equivalent. I’m looking into better code plugins but please check the HTML code parts if you are seeing strangle results.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
#####################################################################
$APIKEy =  "APIKEY"
$orgID = "ORGID"
$APIEndpoint = "https://api.itglue.com"
$FlexAssetName = "Active Directory - AutoDoc"
$Description = "A network one-page document that shows the current configuration for Active Directory."
#####################################################################
#Grabbing ITGlue Module and installing.
If (Get-Module -ListAvailable -Name "ITGlueAPI") {
    Import-module ITGlueAPI
}
Else {
    Install-Module ITGlueAPI -Force
    Import-Module ITGlueAPI
}

#Settings IT-Glue logon information
Add-ITGlueBaseURI -base_uri $APIEndpoint
Add-ITGlueAPIKey $APIKEy

function Get-WinADForestInformation {
    $Data = @{ }
    $ForestInformation = $(Get-ADForest)
    $Data.Forest = $ForestInformation
    $Data.RootDSE = $(Get-ADRootDSE -Properties *)
    $Data.ForestName = $ForestInformation.Name
    $Data.ForestNameDN = $Data.RootDSE.defaultNamingContext
    $Data.Domains = $ForestInformation.Domains
    $Data.ForestInformation = @{
        'Name'                    = $ForestInformation.Name
        'Root Domain'             = $ForestInformation.RootDomain
        'Forest Functional Level' = $ForestInformation.ForestMode
        'Domains Count'           = ($ForestInformation.Domains).Count
        'Sites Count'             = ($ForestInformation.Sites).Count
        'Domains'                 = ($ForestInformation.Domains) -join ", "
        'Sites'                   = ($ForestInformation.Sites) -join ", "
    }

    $Data.UPNSuffixes = Invoke-Command -ScriptBlock {
        $UPNSuffixList  =  [PSCustomObject] @{
                "Primary UPN" = $ForestInformation.RootDomain
                "UPN Suffixes"   = $ForestInformation.UPNSuffixes -join ","
            }
        return $UPNSuffixList
    }

    $Data.GlobalCatalogs = $ForestInformation.GlobalCatalogs
    $Data.SPNSuffixes = $ForestInformation.SPNSuffixes

    $Data.Sites = Invoke-Command -ScriptBlock {
      $Sites = [System.DirectoryServices.ActiveDirectory.Forest]::GetCurrentForest().Sites
        $SiteData = foreach ($Site in $Sites) {
          [PSCustomObject] @{
                "Site Name" = $site.Name
                "Subnets"   = ($site.Subnets) -join ", "
                "Servers" = ($Site.Servers) -join ", "
            }
        }
        Return $SiteData
    }


    $Data.FSMO = Invoke-Command -ScriptBlock {
        [PSCustomObject] @{
            "Domain" = $ForestInformation.RootDomain
            "Role"   = 'Domain Naming Master'
            "Holder" = $ForestInformation.DomainNamingMaster
        }

        [PSCustomObject] @{
            "Domain" = $ForestInformation.RootDomain
            "Role"   = 'Schema Master'
            "Holder" = $ForestInformation.SchemaMaster
        }

        foreach ($Domain in $ForestInformation.Domains) {
            $DomainFSMO = Get-ADDomain $Domain | Select-Object PDCEmulator, RIDMaster, InfrastructureMaster

            [PSCustomObject] @{
                "Domain" = $Domain
                "Role"   = 'PDC Emulator'
                "Holder" = $DomainFSMO.PDCEmulator
            }


            [PSCustomObject] @{
                "Domain" = $Domain
                "Role"   = 'Infrastructure Master'
                "Holder" = $DomainFSMO.InfrastructureMaster
            }

            [PSCustomObject] @{
                "Domain" = $Domain
                "Role"   = 'RID Master'
                "Holder" = $DomainFSMO.RIDMaster
            }

        }

        Return $FSMO
    }

    $Data.OptionalFeatures = Invoke-Command -ScriptBlock {
        $OptionalFeatures = $(Get-ADOptionalFeature -Filter * )
        $Optional = @{
            'Recycle Bin Enabled'                          = ''
            'Privileged Access Management Feature Enabled' = ''
        }
        ### Fix Optional Features
        foreach ($Feature in $OptionalFeatures) {
            if ($Feature.Name -eq 'Recycle Bin Feature') {
                if ("$($Feature.EnabledScopes)" -eq '') {
                    $Optional.'Recycle Bin Enabled' = $False
                }
                else {
                    $Optional.'Recycle Bin Enabled' = $True
                }
            }
            if ($Feature.Name -eq 'Privileged Access Management Feature') {
                if ("$($Feature.EnabledScopes)" -eq '') {
                    $Optional.'Privileged Access Management Feature Enabled' = $False
                }
                else {
                    $Optional.'Privileged Access Management Feature Enabled' = $True
                }
            }
        }
        return $Optional
        ### Fix optional features
    }
    return $Data

}

$TableHeader = "<table class=`"table table-bordered table-hover`" style=`"width:80%`">"
$Whitespace = "<br/>"
$TableStyling = "<th>", "<th style=`"background-color:#4CAF50`">"

$RawAD = Get-WinADForestInformation

$ForestRawInfo = new-object PSCustomObject -property $RawAD.ForestInformation | convertto-html -Fragment | Select-Object -Skip 1
$ForestNice = $TableHeader + ($ForestRawInfo -replace $TableStyling) + $Whitespace

$SiteRawInfo = $RawAD.Sites | Select-Object 'Site Name', Servers, Subnets | ConvertTo-Html -Fragment | Select-Object -Skip 1
$SiteNice = $TableHeader + ($SiteRawInfo -replace $TableStyling) + $Whitespace

$OptionalRawFeatures = new-object PSCustomObject -property $RawAD.OptionalFeatures | convertto-html -Fragment | Select-Object -Skip 1
$OptionalNice = $TableHeader + ($OptionalRawFeatures -replace $TableStyling) + $Whitespace

$UPNRawFeatures = $RawAD.UPNSuffixes |  convertto-html -Fragment -as list| Select-Object -Skip 1
$UPNNice = $TableHeader + ($UPNRawFeatures -replace $TableStyling) + $Whitespace

$DCRawFeatures = $RawAD.GlobalCatalogs | ForEach-Object { Add-Member -InputObject $_ -Type NoteProperty -Name "Domain Controller" -Value $_; $_ } | convertto-html -Fragment | Select-Object -Skip 1
$DCNice = $TableHeader + ($DCRawFeatures -replace $TableStyling) + $Whitespace

$FSMORawFeatures = $RawAD.FSMO | convertto-html -Fragment | Select-Object -Skip 1
$FSMONice = $TableHeader + ($FSMORawFeatures -replace $TableStyling) + $Whitespace

$ForestFunctionalLevel = $RawAD.RootDSE.forestFunctionality
$DomainFunctionalLevel = $RawAD.RootDSE.domainFunctionality
$domaincontrollerMaxLevel = $RawAD.RootDSE.domainControllerFunctionality

$passwordpolicyraw = Get-ADDefaultDomainPasswordPolicy | Select-Object ComplexityEnabled, PasswordHistoryCount, LockoutDuration, LockoutThreshold, MaxPasswordAge, MinPasswordAge | convertto-html -Fragment -As List | Select-Object -skip 1
$passwordpolicyheader = "<tr><th><b>Policy</b></th><th><b>Setting</b></th></tr>"
$passwordpolicyNice = $TableHeader + ($passwordpolicyheader -replace $TableStyling) + ($passwordpolicyraw -replace $TableStyling) + $Whitespace

$adminsraw = Get-ADGroupMember "Domain Admins" | Select-Object SamAccountName, Name | convertto-html -Fragment | Select-Object -Skip 1
$adminsnice = $TableHeader + ($adminsraw -replace $TableStyling) + $Whitespace

$EnabledUsers = (Get-AdUser -filter * | Where-Object { $_.enabled -eq $true }).count
$DisabledUSers = (Get-AdUser -filter \* | Where-Object { $_.enabled -eq $false }).count
$AdminUsers = (Get-ADGroupMember -Identity "Domain Admins").count
$Users = @"
There are <b> $EnabledUsers </b> users Enabled<br>
There are <b> $DisabledUSers </b> users Disabled<br>
There are <b> $AdminUsers </b> Domain Administrator users<br>
"@

$FlexAssetBody = @{
type = 'flexible-assets'
attributes = @{
traits = @{
'domain-name' = $RawAD.ForestName
'forest-summary' = $ForestNice
'site-summary' = $SiteNice
'domain-controllers' = $DCNice
'fsmo-roles' = $FSMONice
'optional-features' = $OptionalNice
'upn-suffixes' = $UPNNice
'default-password-policies' = $passwordpolicyNice
'domain-admins' = $adminsnice
'user-count' = $Users
}
}
}

#Checking if the FlexibleAsset exists. If not, create a new one.
$FilterID = (Get-ITGlueFlexibleAssetTypes -filter_name $FlexAssetName).data
if (!$FilterID) {
$NewFlexAssetData =
@{
type = 'flexible-asset-types'
attributes = @{
name = $FlexAssetName
icon = 'sitemap'
description = $description
}
relationships = @{
"flexible-asset-fields" = @{
data = @(
@{
type = "flexible_asset_fields"
attributes = @{
order = 1
name = "Domain Name"
kind = "Text"
required = $true
"show-in-list" = $true
"use-for-title" = $true
}
},
@{
type = "flexible_asset_fields"
attributes = @{
order = 2
name = "Forest Summary"
kind = "Textbox"
required = $false
"show-in-list" = $false
}
},
@{
type = "flexible_asset_fields"
attributes = @{
order = 3
name = "Site Summary"
kind = "Textbox"
required = $false
"show-in-list" = $false
}
},
@{
type = "flexible_asset_fields"
attributes = @{
order = 4
name = "Domain Controllers"
kind = "Textbox"
required = $false
"show-in-list" = $false
}
},
@{
type = "flexible_asset_fields"
attributes = @{
order = 5
name = "FSMO Roles"
kind = "Textbox"
required = $false
"show-in-list" = $false
}
},
@{
type = "flexible_asset_fields"
attributes = @{
order = 6
name = "Optional Features"
kind = "Textbox"
required = $false
"show-in-list" = $false
}
},
@{
type = "flexible_asset_fields"
attributes = @{
order = 7
name = "UPN Suffixes"
kind = "Textbox"
required = $false
"show-in-list" = $false
}
},
@{
type = "flexible_asset_fields"
attributes = @{
order = 8
name = "Default Password Policies"
kind = "Textbox"
required = $false
"show-in-list" = $false
}
},
@{
type = "flexible_asset_fields"
attributes = @{
order = 9
name = "Domain Admins"
kind = "Textbox"
required = $false
"show-in-list" = $false
}
},
@{
type = "flexible_asset_fields"
attributes = @{
order = 10
name = "User Count"
kind = "Textbox"
required = $false
"show-in-list" = $false
}
}
)
}
}
}
New-ITGlueFlexibleAssetTypes -Data $NewFlexAssetData
$FilterID = (Get-ITGlueFlexibleAssetTypes -filter_name $FlexAssetName).data
}

#Upload data to IT-Glue. We try to match the Server name to current computer name.
$ExistingFlexAsset = (Get-ITGlueFlexibleAssets -filter*flexible_asset_type_id $Filterid.id -filter_organization_id $orgID).data | Where-Object { $*.attributes.traits.'domain-name' -eq $RawAD.ForestName }

#If the Asset does not exist, we edit the body to be in the form of a new asset, if not, we just upload.
if (!$ExistingFlexAsset) {
$FlexAssetBody.attributes.add('organization-id', $orgID)
$FlexAssetBody.attributes.add('flexible-asset-type-id', $FilterID.id)
Write-Host "Creating new flexible asset"
New-ITGlueFlexibleAssets -data $FlexAssetBody
}
else {
Write-Host "Updating Flexible Asset"
$ExistingFlexAsset = $ExistingFlexAsset[-1]
Set-ITGlueFlexibleAssets -id $ExistingFlexAsset.id -data $FlexAssetBody
}

this version of the script does the following:

  • It creates a Flexible Asset configuration in IT-Glue called ” Active Directory – AutoDoc”
  • It creates a Flexible Asset file in the supplied organisation($orgID).
  • The flexible asset file will be filled with the domain name, the forest summary, the site summary, domain controller, fsmo roles, optional features, upn suffixes, default password policies, the domain admins, and a user account.

Special thanks in this blog go out to Przemyslaw Klys for his Get-WinADForestInformation function, and to Jon Czerwinski at Chon Consulting Corp for assisting in some layout and ordering.

Generic version
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
 #Head for HTML file
 $head = @"
 <Title>Server AD report</Title>
 <style>
 body { background-color:#E5E4E2;
       font-family:Monospace;
       font-size:10pt; }
 td, th { border:0px solid black;
         border-collapse:collapse;
         white-space:pre; }
 th { color:white;
     background-color:black; }
 table, tr, td, th {
      padding: 2px;
      margin: 0px;
      white-space:pre; }
 tr:nth-child(odd) {background-color: lightgray}
 table { width:95%;margin-left:5px; margin-bottom:20px; }
 h2 {
 font-family:Tahoma;
 color:#6D7B8D;
 }
 .footer
 { color:green;
  margin-left:10px;
  font-family:Tahoma;
  font-size:8pt;
  font-style:italic;
 }
 </style>
 "@

 function Get-WinADForestInformation {
     $Data = @{ }
     $ForestInformation = $(Get-ADForest)
     $Data.Forest = $ForestInformation
     $Data.RootDSE = $(Get-ADRootDSE -Properties *)
     $Data.ForestName = $ForestInformation.Name
     $Data.ForestNameDN = $Data.RootDSE.defaultNamingContext
     $Data.Domains = $ForestInformation.Domains
     $Data.ForestInformation = @{
         'Name'                    = $ForestInformation.Name
         'Root Domain'             = $ForestInformation.RootDomain
         'Forest Functional Level' = $ForestInformation.ForestMode
         'Domains Count'           = ($ForestInformation.Domains).Count
         'Sites Count'             = ($ForestInformation.Sites).Count
         'Domains'                 = ($ForestInformation.Domains) -join ", "
         'Sites'                   = ($ForestInformation.Sites) -join ", "
     }

     $Data.UPNSuffixes = Invoke-Command -ScriptBlock {
         $UPNSuffixList  =  [PSCustomObject] @{
                 "Primary UPN" = $ForestInformation.RootDomain
                 "UPN Suffixes"   = $ForestInformation.UPNSuffixes -join ","
             }
         return $UPNSuffixList
     }

     $Data.GlobalCatalogs = $ForestInformation.GlobalCatalogs
     $Data.SPNSuffixes = $ForestInformation.SPNSuffixes

     $Data.Sites = Invoke-Command -ScriptBlock {
         $Sites = [System.DirectoryServices.ActiveDirectory.Forest]::GetCurrentForest().Sites
           $SiteData = foreach ($Site in $Sites) {
             [PSCustomObject] @{
                   "Site Name" = $site.Name
                   "Subnets"   = ($site.Subnets) -join ", "
                   "Servers" = ($Site.Servers) -join ", "
               }
           }
           Return $SiteData
       }

     $Data.FSMO = Invoke-Command -ScriptBlock {
         [PSCustomObject] @{
             "Domain" = $ForestInformation.RootDomain
             "Role"   = 'Domain Naming Master'
             "Holder" = $ForestInformation.DomainNamingMaster
         }

         [PSCustomObject] @{
             "Domain" = $ForestInformation.RootDomain
             "Role"   = 'Schema Master'
             "Holder" = $ForestInformation.SchemaMaster
         }

         foreach ($Domain in $ForestInformation.Domains) {
             $DomainFSMO = Get-ADDomain $Domain | Select-Object PDCEmulator, RIDMaster, InfrastructureMaster
             [PSCustomObject] @{
                 "Domain" = $Domain
                 "Role"   = 'PDC Emulator'
                 "Holder" = $DomainFSMO.PDCEmulator
             }

             [PSCustomObject] @{
                 "Domain" = $Domain
                 "Role"   = 'PDC Emulator'
                 "Holder" = $DomainFSMO.PDCEmulator
             }


             [PSCustomObject] @{
                 "Domain" = $Domain
                 "Role"   = 'Infrastructure Master'
                 "Holder" = $DomainFSMO.InfrastructureMaster
             }

             [PSCustomObject] @{
                 "Domain" = $Domain
                 "Role"   = 'RID Master'
                 "Holder" = $DomainFSMO.RIDMaster
             }

         }

         Return $FSMO
     }

     $Data.OptionalFeatures = Invoke-Command -ScriptBlock {
         $OptionalFeatures = $(Get-ADOptionalFeature -Filter * )
         $Optional = @{
             'Recycle Bin Enabled'                          = ''
             'Privileged Access Management Feature Enabled' = ''
         }
         ### Fix Optional Features
         foreach ($Feature in $OptionalFeatures) {
             if ($Feature.Name -eq 'Recycle Bin Feature') {
                 if ("$($Feature.EnabledScopes)" -eq '') {
                     $Optional.'Recycle Bin Enabled' = $False
                 }
                 else {
                     $Optional.'Recycle Bin Enabled' = $True
                 }
             }
             if ($Feature.Name -eq 'Privileged Access Management Feature') {
                 if ("$($Feature.EnabledScopes)" -eq '') {
                     $Optional.'Privileged Access Management Feature Enabled' = $False
                 }
                 else {
                     $Optional.'Privileged Access Management Feature Enabled' = $True
                 }
             }
         }
         return $Optional
         ### Fix optional features
     }
     return $Data
 }

 $TableHeader = "<table class=`"table table-bordered table-hover`" style=`"width:80%`">"
 $Whitespace = "<br/>"
 $TableStyling = "<th>", "<th style=`"background-color:#4CAF50`">"

 $RawAD = Get-WinADForestInformation

 $ForestRawInfo = new-object PSCustomObject -property $RawAD.ForestInformation | convertto-html -Fragment | Select-Object -Skip 1
 $ForestNice = $TableHeader + ($ForestRawInfo -replace $TableStyling) + $Whitespace

 $SiteRawInfo = $RawAD.Sites | Select-Object 'Site Name', Servers, Subnets | ConvertTo-Html -Fragment | Select-Object -Skip 1
 $SiteNice = $TableHeader + ($SiteRawInfo -replace $TableStyling) + $Whitespace

 $OptionalRawFeatures = new-object PSCustomObject -property $RawAD.OptionalFeatures | convertto-html -Fragment | Select-Object -Skip 1
 $OptionalNice = $TableHeader + ($OptionalRawFeatures -replace $TableStyling) + $Whitespace

 $UPNRawFeatures = $RawAD.UPNSuffixes | convertto-html -Fragment | Select-Object -Skip 1
 $UPNNice = $TableHeader + ($UPNRawFeatures -replace $TableStyling) + $Whitespace

 $DCRawFeatures = $RawAD.GlobalCatalogs | ForEach-Object { Add-Member -InputObject $_ -Type NoteProperty -Name "Domain Controller" -Value $_; $_ } | convertto-html -Fragment | Select-Object -Skip 1
 $DCNice = $TableHeader + ($DCRawFeatures -replace $TableStyling) + $Whitespace

 $FSMORawFeatures = $RawAD.FSMO | convertto-html -Fragment | Select-Object -Skip 1
 $FSMONice = $TableHeader + ($FSMORawFeatures -replace $TableStyling) + $Whitespace

 $ForestFunctionalLevel = $RawAD.RootDSE.forestFunctionality
 $DomainFunctionalLevel = $RawAD.RootDSE.domainFunctionality
 $domaincontrollerMaxLevel = $RawAD.RootDSE.domainControllerFunctionality

 $passwordpolicyraw = Get-ADDefaultDomainPasswordPolicy | Select-Object ComplexityEnabled, PasswordHistoryCount, LockoutDuration, LockoutThreshold, MaxPasswordAge, MinPasswordAge | convertto-html -Fragment -As List | Select-Object -skip 1
 $passwordpolicyheader = "<tr><th><b>Policy</b></th><th><b>Setting</b></th></tr>"
 $passwordpolicyNice = $TableHeader + ($passwordpolicyheader -replace $TableStyling) + ($passwordpolicyraw -replace $TableStyling) + $Whitespace

 $adminsraw = Get-ADGroupMember "Domain Admins" | Select-Object SamAccountName, Name | convertto-html -Fragment | Select-Object -Skip 1
 $adminsnice = $TableHeader + ($adminsraw -replace $TableStyling) + $Whitespace

 $EnabledUsers = (Get-AdUser -filter * | Where-Object { $_.enabled -eq $true }).count
 $DisabledUSers = (Get-AdUser -filter * | Where-Object { $_.enabled -eq $false }).count
 $AdminUsers = (Get-ADGroupMember -Identity "Domain Admins").count
 $Users = @"
 There are <b> $EnabledUsers </b> users Enabled<br>
 There are <b> $DisabledUSers </b> users Disabled<br>
 There are <b> $AdminUsers </b> Domain Administrator users<br>
 "@

 $HTMLFile = @"
 $head
 <b>Domain Name</b>: $($RawAD.ForestName) <br>
 <br>
 <h1>Forest Configuration</h1> <br>
 $ForestNice
 <br>
 <h1>Site Summary</h1> <br>
 $SiteNice
 <br>
 <h1>Domain Controllers</h1> <br>
 $DCNice
 <br>
 <h1>FSMO Roles</h1>
 $FSMONice
 <h1>Optional Features</h1>
 $OptionalNice
 <br>
 <h1>UPN Suffixes</h1>
 $UPNNice
 <br>
 <h1>Password Policies</h1>
 $passwordpolicyNice
 <br>
 <h1>Domain Admins</h1>
 $adminsnice
 <br>
 <h1>Domain Admins</h1>
 $Users
 <br>
 "@
 $HTMLFile | out-file C:\Temp\ServerDoc.html

And that’s it. If you want more local documentation without the IT-Glue component you should check out this blog too. as always, Happy PowerShelling.

Update: After some comments from Przemysław Kłys I’ve updated the scripts to be a little more efficient and mostly prettier 🙂

All blogs are posted under AGPL3.0 unless stated otherwise
comments powered by Disqus
Built with Hugo
Theme Stack designed by Jimmy