# PowerShell Form window for installing ADDS

**URL:** <https://forums.powershell.org/t/powershell-form-window-for-installing-adds/14969>\
**Category:** PowerShell Help\
**Created:** [September 18, 2020, 10:47pm UTC](https://forums.powershell.org/t/powershell-form-window-for-installing-adds/14969 "2020-09-18T22:47:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![biswajeet](https://avatars.discourse-cdn.com/v4/letter/b/d9b06d/32.png) [@biswajeet](https://forums.powershell.org/u/biswajeet)\
**Post date:** [September 18, 2020, 10:47pm UTC](https://forums.powershell.org/t/powershell-form-window-for-installing-adds/14969/1 "2020-09-18T22:47:39Z")

</div>

Hi,

I have created a form window using PowerShell to just install ADDS in a server. I click the start button it starts the function but then instead of installing the feature it gets stuck in 10 % and displays warning.

Warning message:

warning: the plug-in for “active directory domain services” is taking more time to load than expected.

Code:

```
Add-Type -AssemblyName System.Windows.Forms
Add-Type -AssemblyName System.Drawing
[System.Windows.Forms.Application]::EnableVisualStyles()
[System.Windows.Forms.FormClosingEventHandler]
 

$Form = New-Object system.Windows.Forms.Form
$Form.ClientSize = '600,200'
$Form.text = "DC Promotion "
$Form.TopMost = $true

$Button1 = New-Object system.Windows.Forms.Button
$Button1.text = "Start"
$Button1.width = 150
$Button1.height = 30
$Button1.DialogResult = [System.Windows.Forms.DialogResult]::OK
$Button1.location = New-Object System.Drawing.Point(200, 140)
$Button1.Font = 'Segoe UI,10'
$Button1.Add_Click({Button1_Click;})

$Form.controls.AddRange(@( $Button1))

######### code Starts ###########

function Button1_Click()
{

            Install-WindowsFeature –Name AD-Domain-Services -IncludeManagementTools
            }
      
####### end of code ######

[void]$Form.Add_Shown({ $Form.Activate() })

[void]$Form.ShowDialog()
```

Don’t understand running the code only from PowerShell does the job but using it form get it stuck.

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:28pm UTC](https://forums.powershell.org/t/powershell-form-window-for-installing-adds/14969/2 "2024-05-16T20:28:52Z")

</div>


