├── LICENSE ├── README.md ├── endpoints └── objects.ps1 ├── images ├── attributes.png ├── create-user.png ├── dashboard.png ├── deleted-objects.png ├── group-membership.png ├── icon.png ├── object-overview.png ├── reset-password.png └── search.png ├── pages ├── deleted-objects.ps1 ├── explorer.ps1 ├── home.ps1 ├── object.ps1 ├── search.ps1 └── user-management │ ├── add-to-group.ps1 │ ├── create-user.ps1 │ └── reset-password.ps1 ├── ud-activedirectory.psd1 ├── ud-activedirectory.psm1 └── udad-init.psm1 /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Adam Driscoll 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ud-activedirectory 2 | 3 | Active Directory Dashboard built on Universal Dashboard. 4 | 5 | [Marketplace](https://ironmansoftware.com/product/active-directory-dashboard/) 6 | 7 | ## Features 8 | 9 | - Overview of Active Directory Forest and Domains 10 | - Search for Objects 11 | - View All Attributes 12 | - Reset User Passwords 13 | - Create Users 14 | 15 | ## Usage 16 | 17 | ``` 18 | Import-Module ud-activedirectory 19 | Start-UDActiveDirectoryDashboard -Server myDomainController -Credential administrator 20 | ``` 21 | 22 | ## Description 23 | 24 | This dashboard reads data from a domain and produces a dashboard that displays basic information about the domain on the home page. From there you can also search the domain, view objects and their attribute and create users. The dashboard features a login page and custom navigation. 25 | 26 | ## Home Page Dashboard 27 | 28 | ![](./images/dashboard.png) 29 | 30 | ## Search for Objects 31 | 32 | ![](./images/search.png) 33 | 34 | ## Object Overview 35 | 36 | ![](./images/object-overview.png) 37 | 38 | ## View All Attributes 39 | 40 | ![](./images/attributes.png) 41 | 42 | ## Create Users 43 | 44 | ![](./images/create-user.png) 45 | 46 | ## Reset Passwords 47 | 48 | ![](./images/reset-password.png) 49 | 50 | ## Manage Group Membership 51 | 52 | ![](./images/group-membership.png) 53 | 54 | ## Show Deleted Objects 55 | 56 | ![](./images/deleted-objects.png) 57 | 58 | _Icon from [Icons8](http://icons8.com)_ 59 | -------------------------------------------------------------------------------- /endpoints/objects.ps1: -------------------------------------------------------------------------------- 1 | New-UDEndpoint -Endpoint { 2 | try 3 | { 4 | $Objects = Get-ADObject -Filter { Name -like '*'} @Cache:ConnectionInfo 5 | $Cache:Classes = $Objects | Group-Object -Property ObjectClass | Sort-Object -Property Count -Descending | Select-Object -First 10 6 | 7 | $Computers = $Objects | Where-Object ObjectClass -eq 'computer' 8 | 9 | $DomainControllers = Get-ADDomainController -Filter {Name -like '*'} @Cache:ConnectionInfo 10 | 11 | $Cache:Computers = @{ 12 | Total = ($Computers | Measure-Object).Count 13 | Disabled = ($Computers | Where-Object Enabled -eq $false | Measure-Object).Count 14 | 'Domain Controllers' = ($DomainControllers | Measure-Object).Count 15 | }.GetEnumerator() 16 | 17 | $Users = Get-ADUser -Filter { Name -like '*'} @Cache:ConnectionInfo -Properties * 18 | 19 | $Cache:Users = @{ 20 | Total = ($Users | Measure-Object).Count 21 | Disabled = ($Users | Where-Object Enabled -eq $false | Measure-Object).Count 22 | }.GetEnumerator() 23 | 24 | $Cache:Forest = Get-ADForest @Cache:ConnectionInfo 25 | $Cache:Domains = Get-ADDomain @Cache:ConnectionInfo 26 | } 27 | catch 28 | { 29 | $Cache:Error = "Failed to load AD data. $_" 30 | } 31 | finally 32 | { 33 | $Cache:Loading = $false 34 | } 35 | }-Schedule (New-UDEndpointSchedule -Every 30 -Second) -------------------------------------------------------------------------------- /images/attributes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adamdriscoll/ud-activedirectory/9422a68aababca782b39f9ec82a4c6141fa81db8/images/attributes.png -------------------------------------------------------------------------------- /images/create-user.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adamdriscoll/ud-activedirectory/9422a68aababca782b39f9ec82a4c6141fa81db8/images/create-user.png -------------------------------------------------------------------------------- /images/dashboard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adamdriscoll/ud-activedirectory/9422a68aababca782b39f9ec82a4c6141fa81db8/images/dashboard.png -------------------------------------------------------------------------------- /images/deleted-objects.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adamdriscoll/ud-activedirectory/9422a68aababca782b39f9ec82a4c6141fa81db8/images/deleted-objects.png -------------------------------------------------------------------------------- /images/group-membership.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adamdriscoll/ud-activedirectory/9422a68aababca782b39f9ec82a4c6141fa81db8/images/group-membership.png -------------------------------------------------------------------------------- /images/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adamdriscoll/ud-activedirectory/9422a68aababca782b39f9ec82a4c6141fa81db8/images/icon.png -------------------------------------------------------------------------------- /images/object-overview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adamdriscoll/ud-activedirectory/9422a68aababca782b39f9ec82a4c6141fa81db8/images/object-overview.png -------------------------------------------------------------------------------- /images/reset-password.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adamdriscoll/ud-activedirectory/9422a68aababca782b39f9ec82a4c6141fa81db8/images/reset-password.png -------------------------------------------------------------------------------- /images/search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adamdriscoll/ud-activedirectory/9422a68aababca782b39f9ec82a4c6141fa81db8/images/search.png -------------------------------------------------------------------------------- /pages/deleted-objects.ps1: -------------------------------------------------------------------------------- 1 | New-UDPage -Name "Deleted Objects" -Content { 2 | New-UDGrid -Title "Deleted Objects" -Headers @("Name", "Distinguished Name") -Properties @("Name", "DistinguishedName") -Endpoint { 3 | Get-ADObject -Filter {(isdeleted -eq $true) -and (name -ne "Deleted Objects")} -includeDeletedObjects @Cache:ConnectionInfo | Out-UDGridData 4 | } 5 | } -------------------------------------------------------------------------------- /pages/explorer.ps1: -------------------------------------------------------------------------------- 1 | New-UDPage -Name "Explorer" -Icon folder -Content { 2 | New-UDRow -Columns { 3 | New-UDColumn -SmallSize 12 -LargeSize 3 -Content { 4 | 5 | $Domain = Get-ADDomain @Cache:ConnectionInfo 6 | 7 | $DomainNode = New-UDTreeNode -Name $Domain -Id "domain" 8 | New-UDTreeView -Node $DomainNode -OnNodeClicked { 9 | param($Body) 10 | $Obj = $Body | ConvertFrom-Json 11 | 12 | if ($Obj.NodeId -eq 'domain') { 13 | Get-ChildItem -Path "AD:\" | ForEach-Object { 14 | New-UDTreeNode -Name $_.Name -Id $_.DistinguishedName 15 | } 16 | } 17 | else 18 | { 19 | Get-ChildItem -Path "AD:\$($Obj.NodeId)" | ForEach-Object { 20 | New-UDTreeNode -Name $_.Name -Id $_.DistinguishedName 21 | } 22 | } 23 | } 24 | } 25 | New-UDColumn -SmallSize 12 -LargeSize 9 { 26 | 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /pages/home.ps1: -------------------------------------------------------------------------------- 1 | New-UDPage -Name "Home" -Icon home -DefaultHomePage -Content { 2 | New-UDRow -Endpoint { 3 | New-UDColumn -Size 12 -Content { 4 | if ($Cache:Loading) { 5 | New-UDPreloader -Circular 6 | } 7 | elseif ($Cache:Error -ne $null) 8 | { 9 | New-UDCard -Title "Error loading data" -Content { 10 | $Cache:Error 11 | } 12 | } 13 | else 14 | { 15 | New-UDRow -Columns { 16 | New-UDColumn -SmallSize 4 -Content { 17 | New-UDChart -Type Bar -Title "Users" -Endpoint { 18 | $Cache:Users | Out-UDChartData -DataProperty 'Value' -LabelProperty 'Name' -BackgroundColor $Cache:ChartColorPalette 19 | } 20 | } 21 | New-UDColumn -SmallSize 4 -Content { 22 | New-UDChart -Type Bar -Title "Computers" -Endpoint { 23 | $Cache:Computers | Out-UDChartData -DataProperty 'Value' -LabelProperty 'Name' -BackgroundColor $Cache:ChartColorPalette 24 | } 25 | } 26 | New-UDColumn -SmallSize 4 -Content { 27 | New-UDChart -Type Pie -Id 'ObjectClasses' -Title "Top Classes" -Endpoint { 28 | $Cache:Classes | Out-UDChartData -DataProperty 'Count' -LabelProperty 'Name' -BackgroundColor $Cache:ChartColorPalette 29 | } 30 | } 31 | } 32 | 33 | New-UDRow -Columns { 34 | New-UDColumn -Size 12 -Content { 35 | New-UDTable -Title "Forest" -Headers @("Name", "Root Domain", "Mode") -Endpoint { 36 | $Cache:Forest | ForEach-Object { 37 | [PSCustomObject]@{ 38 | Name = $_.Name 39 | RootDomain = $_.RootDomain 40 | ForestMode = $_.ForestMode.ToString() 41 | } 42 | } | Out-UDTableData -Property @("Name", "RootDomain", "ForestMode") 43 | } -Style highlight 44 | } 45 | } 46 | 47 | New-UDRow -Columns { 48 | New-UDColumn -Size 12 -Content { 49 | New-UDTable -Title "Domains" -Headers @("Name", "Forest", "Mode", "DNS Root") -Endpoint { 50 | $Cache:Domains | ForEach-Object { 51 | [PSCustomObject]@{ 52 | Name = $_.Name 53 | Forest = $_.Forest 54 | DomainMode = $_.DomainMode.ToString() 55 | DnsRoot = $_.DNSRoot 56 | } 57 | } | Out-UDTableData -Property @("Name", "Forest", "DomainMode", "DNSRoot") 58 | } -Style highlight 59 | } 60 | } 61 | } 62 | } 63 | } 64 | } -------------------------------------------------------------------------------- /pages/object.ps1: -------------------------------------------------------------------------------- 1 | New-UDPage -Url "/object/:identity" -Endpoint { 2 | param($identity) 3 | 4 | $Object = Get-ADObject -Filter { Name -eq $Identity } @Cache:ConnectionInfo -Properties ObjectClass -IncludeDeletedObjects 5 | if ($Object.ObjectClass -eq "user") 6 | { 7 | $Object = Get-ADUser -Filter { Name -eq $Identity } @Cache:ConnectionInfo -Properties * 8 | } 9 | elseif ($Object.ObjectClass -eq "computer") 10 | { 11 | $Object = Get-ADComputer -Filter { Name -eq $Identity } @Cache:ConnectionInfo -Properties * 12 | } 13 | elseif ($Object.ObjectClass -eq "group") 14 | { 15 | $Object = Get-ADGroup -Filter { Name -eq $Identity } @Cache:ConnectionInfo -Properties * 16 | } 17 | else 18 | { 19 | $Object = Get-ADObject -Filter { Name -eq $Identity } @Cache:ConnectionInfo -Properties * -IncludeDeletedObjects 20 | } 21 | 22 | New-UDRow -Columns { 23 | New-UDColumn -Size 4 -Content { 24 | New-UDCard -Title $Object.DisplayName -Content { 25 | New-UDRow -Columns { 26 | New-UDColumn -Size 4 -Content { 27 | New-ADIcon -ObjectClass $Object.ObjectClass -Size 5x 28 | } 29 | New-UDColumn -Size 8 -Content { 30 | New-UDHeading -Size 5 -Text ($Object.GivenName + " " + $Object.SurName) 31 | New-UDHeading -Size 5 -Text $Object.SamAccountName 32 | } 33 | } 34 | } 35 | } 36 | 37 | if (-not $Object.Deleted) 38 | { 39 | New-UDColumn -Size 4 -Content { 40 | New-UDElement -Tag "div" -Attributes @{ style = @{ height = "10px"}} 41 | New-UDButton -Icon trash -Text "Delete" -OnClick { 42 | Show-UDModal -Header { New-UDHeading -Size 5 -Text "Are you sure you want to delete this object?" } -Content { 43 | 44 | New-UDHeading -Size 5 -Text "Clicking ok will run: Remove-ADObject -Identity $($Object.samAccountName) -Confirm:`$false" 45 | 46 | New-UDRow -Columns { 47 | New-UDColumn -Size 2 -Content { 48 | New-UDButton -Text "Ok" -OnClick { 49 | Remove-ADObject -Identity $Object.samAccountName @Cache:ConnectionInfo -Confirm:$false 50 | Hide-UDModal 51 | Invoke-UDRedirect -Url "/home" 52 | } -Icon warning 53 | } 54 | New-UDColumn -Size 2 -Content { 55 | New-UDButton -Text "Cancel" -OnClick { 56 | Hide-UDModal 57 | } 58 | } 59 | } 60 | } 61 | } 62 | 63 | if ($Object.ObjectClass -eq "user" -or $Object.ObjectClass -eq "computer") 64 | { 65 | $EnabledText = "Enable" 66 | $btnIcon = 'check' 67 | if ($Object.Enabled) 68 | { 69 | $EnabledText = "Disable" 70 | $btnIcon = 'xing' 71 | } 72 | 73 | New-UDElement -Tag "div" -Attributes @{ style = @{ height = "10px"}} -Content {} 74 | New-UDButton -Id "btnEnabled" -Icon $btnIcon -Text $EnabledText -OnClick { 75 | if ($Object.Enabled) 76 | { 77 | $Object.Enabled = $(Disable-ADAccount -Identity $Object.samAccountName @Cache:ConnectionInfo -PassThru).Enabled 78 | Set-UDElement -Id "btnEnabled" -Content { 79 | New-UDIcon -Icon 'check' 80 | "Enable" 81 | } 82 | } 83 | else 84 | { 85 | $Object.Enabled = $(Enable-ADAccount -Identity $Object.samAccountName @Cache:ConnectionInfo -PassThru).Enabled 86 | Set-UDElement -Id "btnEnabled" -Content { 87 | New-UDIcon -Icon 'xing' 88 | "Disable" 89 | } 90 | } 91 | } 92 | } 93 | } 94 | } 95 | 96 | 97 | } 98 | 99 | if ($Object.ObjectClass -eq 'user') 100 | { 101 | New-UDRow -Columns { 102 | New-UDColumn -SmallSize 12 -Content { 103 | New-UDCollapsible -Items { 104 | New-UDCollapsibleItem -Title "Reset Password" -Icon star_half_o -Content { 105 | New-UDInput -Title "Reset Password" -SubmitText "Reset" -Content { 106 | New-UDInputField -Name "Password" -Placeholder "Password" -Type "password" 107 | } -Endpoint { 108 | param($Password) 109 | 110 | try 111 | { 112 | Set-ADAccountPassword -Reset -NewPassword (ConvertTo-SecureString -AsPlainText -String $Password -Force) -Identity $identity @Cache:ConnectionInfo 113 | New-UDInputAction -Toast "Password Reset" -Duration 3000 114 | } 115 | catch 116 | { 117 | New-UDInputAction -Toast "$_" -Duration 3000 118 | } 119 | } 120 | } 121 | } 122 | } 123 | } 124 | } 125 | 126 | if ($Object.ObjectClass -eq 'group') 127 | { 128 | New-UDRow -Columns { 129 | New-UDColumn -SmallSize 12 -Content { 130 | New-UDCollapsible -Items { 131 | New-UDCollapsibleItem -Title "Members" -Icon users -Content { 132 | New-UDTable -Id "members" -Headers @("Name", "Remove") -Endpoint { 133 | Get-ADGroupMember -Identity $identity @Cache:ConnectionInfo | ForEach-Object { 134 | $member = $_ 135 | [PSCustomObject]@{ 136 | Name = $_.name 137 | Remove = New-UDButton -Text "Remove" -OnClick { 138 | Remove-ADGroupMember -Identity $identity @Cache:ConnectionInfo -Members $member -Confirm:$false 139 | } 140 | } 141 | } | Out-UDTableData -Property @("Name", "Remove") 142 | } -AutoRefresh -RefreshInterval 5 143 | } 144 | } 145 | } 146 | } 147 | } 148 | 149 | New-UDRow -Columns { 150 | New-UDColumn -Size 12 -Content { 151 | New-UDTable -Title "Attributes" -Headers @("Name", "Value") -Endpoint { 152 | 153 | $SkippedProperties = @("PropertyNames", "AddedProperties", "ModifiedProperties", "RemovedProperties", "PropertyCount") 154 | 155 | $Object.psobject.Properties | ForEach-Object { 156 | 157 | if ($SkippedProperties.Contains( $_.Name)) 158 | { 159 | return 160 | } 161 | 162 | $Value = $Null 163 | if ($_.Value -eq $null) 164 | { 165 | $Value = ' ' 166 | } 167 | elseif ($_.Value -is [Microsoft.ActiveDirectory.Management.ADPropertyValueCollection]) 168 | { 169 | $Value = ($_.Value | ForEach-Object { 170 | $_.ToString() 171 | New-UDElement -Tag "br" 172 | }) 173 | } 174 | else 175 | { 176 | $Value = $_.Value.ToString() 177 | } 178 | 179 | [PSCustomObject]@{ 180 | Name = $_.Name 181 | Value = $Value 182 | } | Out-UDTableData -Property @("Name", "Value") 183 | } 184 | } 185 | } 186 | } 187 | } -------------------------------------------------------------------------------- /pages/search.ps1: -------------------------------------------------------------------------------- 1 | New-UDPage -Name "Search" -Icon search -Content { 2 | 3 | New-UDElement -Tag "div" -Attributes @{ 4 | style = @{ 5 | height = '25px' 6 | } 7 | } 8 | 9 | New-UDRow -Columns { 10 | New-UDColumn -Size 10 -SmallOffset 1 -Content { 11 | New-UDRow -Columns { 12 | New-UDColumn -Size 10 -Content { 13 | New-UDTextbox -Id "txtSearch" -Label "Search" -Placeholder "Search for an object" -Icon search 14 | } 15 | New-UDColumn -Size 2 -Content { 16 | New-UDButton -Id "btnSearch" -Text "Search" -Icon search -OnClick { 17 | $Element = Get-UDElement -Id "txtSearch" 18 | $Value = $Element.Attributes["value"] 19 | 20 | Set-UDElement -Id "results" -Content { 21 | New-UDGrid -Title "Search Results for: $Value" -Headers @("Name", "More Info") -Properties @("Name", "MoreInfo") -Endpoint { 22 | $Objects = Get-ADObject -Filter "Name -like '$Value' -or samAccountName -like '$Value'" -ResultSetSize 20 @Cache:ConnectionInfo -IncludeDeletedObjects 23 | $Objects | ForEach-Object { 24 | [PSCustomObject]@{ 25 | Name = $_.Name 26 | MoreInfo = New-UDButton -Text "More Info" -OnClick { 27 | Invoke-UDRedirect -Url "/object/$($_.Name)" 28 | } 29 | } 30 | } | Out-UDGridData 31 | } 32 | } 33 | } 34 | } 35 | } 36 | } 37 | } 38 | 39 | New-UDRow -Columns { 40 | New-UDColumn -SmallSize 10 -SmallOffset 1 { 41 | New-UDElement -Tag "div" -Id "results" 42 | } 43 | } 44 | } -------------------------------------------------------------------------------- /pages/user-management/add-to-group.ps1: -------------------------------------------------------------------------------- 1 | New-UDPage -Url "/user/add-to-group" -Icon Plus -Endpoint { 2 | New-UDRow -Columns { 3 | New-UDColumn -Size 12 -Content { 4 | New-UDInput -Title "Add to Group" -SubmitText "Add" -Content { 5 | New-UDInputField -Name "UserName" -Placeholder "Account Name" -Type "textbox" 6 | New-UDInputField -Name "GroupName" -Placeholder "Group Name" -Type "textbox" 7 | } -Endpoint { 8 | param( 9 | $UserName, 10 | $GroupName 11 | ) 12 | 13 | try 14 | { 15 | Add-ADGroupMember -Identity $GroupName -Members (Get-ADUser -Identity $UserName @Cache:ConnectionInfo) @Cache:ConnectionInfo 16 | New-UDInputAction -RedirectUrl "/object/$UserName" 17 | } 18 | catch 19 | { 20 | New-UDInputAction -Toast "Failed to add user to group. $_" 21 | } 22 | } 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /pages/user-management/create-user.ps1: -------------------------------------------------------------------------------- 1 | New-UDPage -Url "/user/create" -Icon Plus -Endpoint { 2 | New-UDRow -Columns { 3 | New-UDColumn -Size 12 -Content { 4 | New-UDInput -Title "Create User" -SubmitText "Create" -Content { 5 | New-UDInputField -Name "FirstName" -Placeholder "First Name" -Type "textbox" 6 | New-UDInputField -Name "LastName" -Placeholder "Last Name" -Type "textbox" 7 | New-UDInputField -Name "UserName" -Placeholder "Account Name" -Type "textbox" 8 | New-UDInputField -Name "Password" -Placeholder "Password" -Type "password" 9 | } -Endpoint { 10 | param( 11 | $FirstName, 12 | $LastName, 13 | $UserName, 14 | $Password 15 | ) 16 | 17 | try 18 | { 19 | New-ADUser -Name $UserName -GivenName $FirstName -Surname $LastName @Cache:ConnectionInfo 20 | $SecurePassword = ConvertTo-SecureString -AsPlainText -String $Password -Force 21 | Set-ADAccountPassword -Reset -NewPassword $SecurePassword -Identity $UserName @Cache:ConnectionInfo 22 | New-UDInputAction -RedirectUrl "/object/$UserName" 23 | } 24 | catch 25 | { 26 | New-UDInputAction -Toast "Failed to add user. $_" 27 | } 28 | } 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /pages/user-management/reset-password.ps1: -------------------------------------------------------------------------------- 1 | New-UDPage -Url "/user/reset-password" -Icon Plus -Endpoint { 2 | New-UDRow -Columns { 3 | New-UDColumn -Size 12 -Content { 4 | New-UDInput -Title "Reset Password" -SubmitText "Reset Password" -Content { 5 | New-UDInputField -Name "UserName" -Placeholder "Account Name" -Type "textbox" 6 | New-UDInputField -Name "Password" -Placeholder "Password" -Type "password" 7 | } -Endpoint { 8 | param( 9 | $UserName, 10 | $Password 11 | ) 12 | 13 | try 14 | { 15 | $SecurePassword = ConvertTo-SecureString $Password -AsPlainText -Force 16 | Set-ADAccountPassword -Reset -NewPassword $SecurePassword -Identity $UserName @Cache:ConnectionInfo 17 | New-UDInputAction -RedirectUrl "/object/$UserName" 18 | } 19 | catch 20 | { 21 | New-UDInputAction -Toast "Failed to add user. $_" 22 | } 23 | } 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /ud-activedirectory.psd1: -------------------------------------------------------------------------------- 1 | # 2 | # Module manifest for module 'ud-activedirectory' 3 | # 4 | # Generated by: Adam Driscoll 5 | # 6 | # Generated on: 4/03/2018 7 | # 8 | 9 | @{ 10 | 11 | # Script module or binary module file associated with this manifest. 12 | RootModule = '.\ud-activedirectory.psm1' 13 | 14 | # Version number of this module. 15 | ModuleVersion = '1.2' 16 | 17 | # Supported PSEditions 18 | # CompatiblePSEditions = @() 19 | 20 | # ID used to uniquely identify this module 21 | GUID = '36c51211-fbfa-4985-9880-2ec8c6625942' 22 | 23 | # Author of this module 24 | Author = 'Adam Driscoll' 25 | 26 | # Company or vendor of this module 27 | CompanyName = 'Ironman Software, LLC' 28 | 29 | # Copyright statement for this module 30 | Copyright = '(c) 2018 Adam Driscoll. All rights reserved.' 31 | 32 | # Description of the functionality provided by this module 33 | Description = 'Active Directory dashboard and management.' 34 | 35 | # Minimum version of the Windows PowerShell engine required by this module 36 | # PowerShellVersion = '' 37 | 38 | # Name of the Windows PowerShell host required by this module 39 | # PowerShellHostName = '' 40 | 41 | # Minimum version of the Windows PowerShell host required by this module 42 | # PowerShellHostVersion = '' 43 | 44 | # Minimum version of Microsoft .NET Framework required by this module. This prerequisite is valid for the PowerShell Desktop edition only. 45 | # DotNetFrameworkVersion = '' 46 | 47 | # Minimum version of the common language runtime (CLR) required by this module. This prerequisite is valid for the PowerShell Desktop edition only. 48 | # CLRVersion = '' 49 | 50 | # Processor architecture (None, X86, Amd64) required by this module 51 | # ProcessorArchitecture = '' 52 | 53 | # Modules that must be imported into the global environment prior to importing this module 54 | RequiredModules = @('UniversalDashboard') 55 | 56 | # Assemblies that must be loaded prior to importing this module 57 | # RequiredAssemblies = @() 58 | 59 | # Script files (.ps1) that are run in the caller's environment prior to importing this module. 60 | # ScriptsToProcess = @() 61 | 62 | # Type files (.ps1xml) to be loaded when importing this module 63 | # TypesToProcess = @() 64 | 65 | # Format files (.ps1xml) to be loaded when importing this module 66 | # FormatsToProcess = @() 67 | 68 | # Modules to import as nested modules of the module specified in RootModule/ModuleToProcess 69 | # NestedModules = @() 70 | 71 | # 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 = 'Start-UDActiveDirectoryDashboard' 73 | 74 | # 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. 75 | CmdletsToExport = '*' 76 | 77 | # Variables to export from this module 78 | VariablesToExport = '*' 79 | 80 | # Aliases 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 aliases to export. 81 | AliasesToExport = '*' 82 | 83 | # DSC resources to export from this module 84 | # DscResourcesToExport = @() 85 | 86 | # List of all modules packaged with this module 87 | # ModuleList = @() 88 | 89 | # List of all files packaged with this module 90 | # FileList = @() 91 | 92 | # Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell. 93 | PrivateData = @{ 94 | 95 | PSData = @{ 96 | 97 | # Tags applied to this module. These help with module discovery in online galleries. 98 | Tags = @('UniversalDashboard', 'ud-dashboard', 'activedirectory') 99 | 100 | # A URL to the license for this module. 101 | LicenseUri = 'https://github.com/adamdriscoll/ud-activedirectory/blob/master/LICENSE' 102 | 103 | # A URL to the main website for this project. 104 | ProjectUri = 'https://github.com/adamdriscoll/ud-activedirectory' 105 | 106 | # A URL to an icon representing this module. 107 | IconUri = 'https://github.com/adamdriscoll/ud-activedirectory/raw/master/images/icon.png' 108 | 109 | # ReleaseNotes of this module 110 | # ReleaseNotes = '' 111 | 112 | } # End of PSData hashtable 113 | 114 | } # End of PrivateData hashtable 115 | 116 | # HelpInfo URI of this module 117 | # HelpInfoURI = '' 118 | 119 | # Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix. 120 | # DefaultCommandPrefix = '' 121 | 122 | } 123 | 124 | -------------------------------------------------------------------------------- /ud-activedirectory.psm1: -------------------------------------------------------------------------------- 1 | function Start-UDActiveDirectoryDashboard { 2 | param( 3 | [Parameter()] 4 | [string]$Server, 5 | [Parameter()] 6 | [PSCredential]$Credential, 7 | [Parameter()] 8 | [int]$Port = 10001 9 | ) 10 | 11 | $Cache:Loading = $true 12 | $Cache:ChartColorPalette = @('#5899DA', '#E8743B', '#19A979', '#ED4A7B', '#945ECF', '#13A4B4', '#525DF4', '#BF399E', '#6C8893', '#EE6868', '#2F6497') 13 | $Cache:ConnectionInfo = @{ 14 | Server = $Server 15 | Credential = $Credential 16 | } 17 | 18 | $Utilities = (Join-Path $PSScriptRoot 'udad-init.psm1') 19 | Import-Module $Utilities 20 | 21 | $Pages = Get-ChildItem (Join-Path $PSScriptRoot 'pages') -Recurse -File | ForEach-Object { 22 | & $_.FullName 23 | } 24 | 25 | $Endpoints = Get-ChildItem (Join-Path $PSScriptRoot 'endpoints') | ForEach-Object { 26 | & $_.FullName 27 | } 28 | 29 | $AuthenticationMethod = New-UDAuthenticationMethod -Endpoint { 30 | param([PSCredential]$Credentials) 31 | 32 | try 33 | { 34 | Write-UDLog -Message $Credentials.UserName 35 | Write-UDLog -Message $Credentials.GetNetworkCredential().Password 36 | Write-UDLog -Message $Cache:ConnectionInfo.Server 37 | Get-ADObject -Credential $Credentials -Server $Cache:ConnectionInfo.Server -Filter "*" -ResultSetSize 1 | Out-Null 38 | New-UDAuthenticationResult -Success -UserName $Credentials.UserName 39 | } 40 | catch 41 | { 42 | Write-UDLog -Message $_ 43 | New-UDAuthenticationResult 44 | } 45 | } 46 | 47 | $LoginPage = New-UDLoginPage -AuthenticationMethod $AuthenticationMethod 48 | 49 | $EndpointInit = New-UDEndpointInitialization -Module 'udad-init.psm1' 50 | 51 | $Navigation = New-UDSideNav -Content { 52 | New-UDSideNavItem -Text "Home" -Url "Home" -Icon home 53 | New-UDSideNavItem -Text "Deleted Objects" -Url "deleted-objects" -Icon user_times 54 | New-UDSideNavItem -Text "Explorer" -Url "Explorer" -Icon folder 55 | New-UDSideNavItem -Text "Search" -Url "Search" -Icon search 56 | New-UDSideNavItem -Text "User Management" -Icon user -Children { 57 | New-UDSideNavItem -Text "Add User To Group" -Url "user/add-to-group" -Icon user_plus 58 | New-UDSideNavItem -Text "Create User" -Url "user/create" -Icon plus_circle 59 | New-UDSideNavItem -Text "Reset Password" -Url "user/reset-password" -Icon code 60 | } 61 | } 62 | 63 | $Dashboard = New-UDDashboard -Title "Active Directory" -Pages $Pages -EndpointInitialization $EndpointInit -LoginPage $LoginPage -Navigation $Navigation 64 | 65 | Start-UDDashboard -Dashboard $Dashboard -Endpoint $Endpoints -Port $Port -AllowHttpForLogin 66 | } 67 | 68 | -------------------------------------------------------------------------------- /udad-init.psm1: -------------------------------------------------------------------------------- 1 | Import-Module ActiveDirectory 2 | Import-Module UniversalDashboard 3 | 4 | New-PSDrive –Name AD –PSProvider ActiveDirectory @Cache:ConnectionInfo –Root "//RootDSE/" -Scope Global 5 | function New-ADIcon { 6 | param($ObjectClass, $Size) 7 | 8 | $icon = 'question_circle' 9 | 10 | if ($ObjectClass -eq 'user') { 11 | $icon = 'user' 12 | } 13 | 14 | if ($ObjectClass -eq 'computer') { 15 | $icon = 'desktop' 16 | } 17 | 18 | if ($ObjectClass -eq 'group') { 19 | $icon = 'users' 20 | } 21 | 22 | New-UDIcon -Icon $icon -Size $Size 23 | } --------------------------------------------------------------------------------