Link to home
Start Free TrialLog in
Avatar of Simon336697
Simon336697Flag for Australia

asked on

Issues with a powershell script

Dear everyone,

I hope you are well and can assist.

I am trying to work on a powershell script to make a windows 2012 member server, a domain controller.

This is what I am doing.

1) Ensure the server is a member of the domain.

2) Verify correct execution status for powershell scripts (remotesigned)
Get-ExecutionPolicy

3) Add the AD DS role along with all required management tools
Add-WindowsFeature -name AD-Domain-Services -IncludeManagementTools

4) Promote the windows 2012 server to a domain controller, using the following script:

Import-Module ADDSDeployment
Install-ADDSDomainController `
-NoGlobalCatalog:$false `
-InstallDns:$false`
-CreateDnsDelegation:$false `
-CriticalReplicationOnly:$false `
-DatabasePath "C:\Windows\NTDS" `
-LogPath "C:\Windows\NTDS" `
-SysvolPath "C:\Windows\SYSVOL" `
-DomainName "ab.company.net" `
-NoRebootOnCompletion:$false `
-SiteName "SiteName" `
-Force:$true


I execute the above as follows:

PS D:\> 2012dc.ps1

cndket Ubstakk-ADDSDomainController at command pipeline position 1
Supply values for the following parameters:
DomainName:

I dont know why it is prompting me to put in a value for the DomainName, since it is in the script itself.

Once I supply the value, it prompts me for the SafeModeAdministratorPassword, and it all works.

I would like to find out what I can do to automate this further, that is, to not have to input the domain name, since I have put this in the powershell script itself.

Even if I delete the domainname line in the script, when I execute the script, it still prompts me to enter the domainname.


An alternative that does work is the following:

install-addsdomaincontroller -domainname "ab.company.net"

Any help greatly appreciated.
ASKER CERTIFIED SOLUTION
Avatar of Christopher Jay Wolff
Christopher Jay Wolff
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of Qlemo
Qlemo
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Simon336697

ASKER

Thanks guys really appreciate it.
Thanks everyone.