Install-ADDSForest ok by script but not in winform

Ask your Windows PowerShell-related questions, including questions on cmdlet development!
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.
User avatar
jvierra
Posts: 13175
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: Install-ADDSForest ok by script but not in winform

Post by jvierra » Wed Aug 08, 2018 1:12 pm

Code: Select all

$sb = {
     Import-Module ADDSDeployment
     Install-ADDSForest @ForestConfiguration
}

Start-Job -ScriptBlock $sb
Sorry - I am not French and my English is still bad.

User avatar
thematterneo
Posts: 11
Joined: Thu Mar 06, 2014 2:22 pm

Re: Install-ADDSForest ok by script but not in winform

Post by thematterneo » Wed Aug 08, 2018 2:03 pm

Thank you but just now I found on web in technet this and it works ! :

Code: Select all

start-job -Name addFeature -ScriptBlock {
Add-WindowsFeature -Name "ad-domain-services" -IncludeAllSubFeature -IncludeManagementTools
Add-WindowsFeature -Name "dns" -IncludeAllSubFeature -IncludeManagementTools
Add-WindowsFeature -Name "gpmc" -IncludeAllSubFeature -IncludeManagementTools }
Wait-Job -Name addFeature

Locked