Issues with a powershell script
Posted on 2014-04-02
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)
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:
-DatabasePath "C:\Windows\NTDS" `
-LogPath "C:\Windows\NTDS" `
-SysvolPath "C:\Windows\SYSVOL" `
-DomainName "ab.company.net" `
-SiteName "SiteName" `
I execute the above as follows:
PS D:\> 2012dc.ps1
cndket Ubstakk-ADDSDomainController at command pipeline position 1
Supply values for the following parameters:
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.