GUI to install new domain

Ask questions about creating Graphical User Interfaces (GUI) in PowerShell and using WinForms controls.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 5 years and 8 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
thematterneo
Posts: 11
Last visit: Fri Oct 12, 2018 2:45 am

GUI to install new domain

Post by thematterneo »

Hello,

I begin to use powershell studio and I have some problem.
I created a project with new form (empty form), I added a button and I put in the button this command :
Install-WindowsFeature -Name AD-Domain-Services -includemanagementtools
Unfortunately, I have the warning : The plug-in for "Active Directory Domain Services" is taking more time to load than expected.
I tested with the command install-WindowsFeature -Name RSAT-ADDS-Tools, I have no problem.
Maybe do you have an idea where is the problem ?
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: GUI to install new domain

Post by jvierra »

Install without the management tools to see if that solves the issue. The Domain Services install is also very long and may have conflicts when run from a form.
User avatar
thematterneo
Posts: 11
Last visit: Fri Oct 12, 2018 2:45 am

Re: GUI to install new domain

Post by thematterneo »

Thank you for your reply.
No, without the management tools, it's the same.
I tried to run this command in powershell, and this role is installed in few seconds.
User avatar
thematterneo
Posts: 11
Last visit: Fri Oct 12, 2018 2:45 am

Re: GUI to install new domain

Post by thematterneo »

I export in ps script :

#------------------------------------------------------------------------
# Source File Information (DO NOT MODIFY)
# Source ID: a885b8f9-ce0e-4b65-93b8-36a1bd9f489b
# Source File: install.psf
#------------------------------------------------------------------------
#region File Recovery Data (DO NOT MODIFY)
<#RecoveryData:
qAIAAB+LCAAAAAAABABlksuOolAURecm/oOpKUkhIK0klskFUQpUXvKcXfAKl7e84evbrp500md0
cnZ2TrKy9gYKyx7V0xG2cPVeGlwWXx/M5/rjsFysVnu1xhEuYHbCGbrBHB1w0bQwyz6r5rkn/0t/
Oqeyzg8ywiM1qJwFdAB44iKAv8MDgbJPlBbNwHren6M2G5wc9w0acl2VTDlEJVZ5wgUZahWCMnHE
kj2yE1gN9+XCjUZ5zXYo3HHVPDB08IyE1Kof61EVt0oFlJYQInK9s31+LWGsjXYPc73zbaXjn0kz
rUGVmpHN8DE9LxcEmFPfGjMxHtTcV8Szg/3YG882CyQv0kIhfCTXcjp/0z2UNoDNnYtoQsWWGIsU
fmllHsgejGeaPz3M5aLhTfdWu0ZlGEEqvHrBQb5YsOJZnu+8FMd6epP4+vLrUYRaAP/wwW8+DyUx
Js1CR6UiCLiWm+vxpgfLhePR6XlL4XY7wu8ZgsJ87SZV11F/frVOH+qVsNnWaccVkNFu1DEn1NC3
SpnsCD5+udf3Y6Q1smCIRrVcIDRCv+FAtLs2yUxNl0couLS1kbrym97qmiklssfFMUVPx0t2awLC
I3hrlzoMU6Xiie+jayvjjBzyTbRcXOnE9VL3nhz5J6uPuXyrNlGUsYXGcXlveAbbagPRTeTxZDDO
K33V5MneSs+q20ipeh4uGRDfKnztyR9VfqQBTYPyIMOoWZHvy57818zDbzpAMUSoAgAA#>
#endregion

<#
.NOTES
--------------------------------------------------------------------------------
Code generated by: SAPIEN Technologies, Inc., PowerShell Studio 2018 v5.5.149
Generated on: 09/07/2018 14:09
Generated by: Administrator
--------------------------------------------------------------------------------
.DESCRIPTION
GUI script generated by PowerShell Studio 2018
#>


#----------------------------------------------
#region Application Functions
#----------------------------------------------

#endregion Application Functions

#----------------------------------------------
# Generated Form Function
#----------------------------------------------
function Show-install_psf {

#----------------------------------------------
#region Import the Assemblies
#----------------------------------------------
[void][reflection.assembly]::Load('System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089')
[void][reflection.assembly]::Load('System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a')
#endregion Import Assemblies

#----------------------------------------------
#region Generated Form Objects
#----------------------------------------------
[System.Windows.Forms.Application]::EnableVisualStyles()
$form1 = New-Object 'System.Windows.Forms.Form'
$button1 = New-Object 'System.Windows.Forms.Button'
$InitialFormWindowState = New-Object 'System.Windows.Forms.FormWindowState'
#endregion Generated Form Objects

#----------------------------------------------
# User Generated Script
#----------------------------------------------

$form1_Load={
#TODO: Initialize Form Controls here

}

$button1_Click={
#TODO: Place custom script here

install-WindowsFeature -Name AD-Domain-Services


}

# --End User Generated Script--
#----------------------------------------------
#region Generated Events
#----------------------------------------------

$Form_StateCorrection_Load=
{
#Correct the initial state of the form to prevent the .Net maximized form issue
$form1.WindowState = $InitialFormWindowState
}

$Form_Cleanup_FormClosed=
{
#Remove all event handlers from the controls
try
{
$button1.remove_Click($button1_Click)
$form1.remove_Load($form1_Load)
$form1.remove_Load($Form_StateCorrection_Load)
$form1.remove_FormClosed($Form_Cleanup_FormClosed)
}
catch { Out-Null <# Prevent PSScriptAnalyzer warning #> }
}
#endregion Generated Events

#----------------------------------------------
#region Generated Form Code
#----------------------------------------------
$form1.SuspendLayout()
#
# form1
#
$form1.Controls.Add($button1)
$form1.AutoScaleDimensions = '6, 13'
$form1.AutoScaleMode = 'Font'
$form1.ClientSize = '284, 261'
$form1.Name = 'form1'
$form1.Text = 'Form'
$form1.add_Load($form1_Load)
#
# button1
#
$button1.Location = '102, 43'
$button1.Name = 'button1'
$button1.Size = '75, 23'
$button1.TabIndex = 0
$button1.Text = 'button1'
$button1.UseCompatibleTextRendering = $True
$button1.UseVisualStyleBackColor = $True
$button1.add_Click($button1_Click)
$form1.ResumeLayout()
#endregion Generated Form Code

#----------------------------------------------

#Save the initial state of the form
$InitialFormWindowState = $form1.WindowState
#Init the OnLoad event to correct the initial state of the form
$form1.add_Load($Form_StateCorrection_Load)
#Clean up the control events
$form1.add_FormClosed($Form_Cleanup_FormClosed)
#Show the Form
return $form1.ShowDialog()

} #End Function

#Call the form
Show-install_psf | Out-Null
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: GUI to install new domain

Post by jvierra »

Try installing it as a Job. That will eliminate the effect of the form.
User avatar
thematterneo
Posts: 11
Last visit: Fri Oct 12, 2018 2:45 am

Re: GUI to install new domain

Post by thematterneo »

Sorry I'm new user of Powershell studio; what do you mean installing as a job ?
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: GUI to install new domain

Post by jvierra »

help start-job -full
help about_jobs
User avatar
thematterneo
Posts: 11
Last visit: Fri Oct 12, 2018 2:45 am

Re: GUI to install new domain

Post by thematterneo »

Ok I see but to install this kind of role, I don't think that it's very appropriate and maybe someone has already got this problem ?
This topic is 5 years and 8 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked