Solved

Issues with a powershell script

Posted on 2014-04-02
5
387 Views
Last Modified: 2014-04-06
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.
0
Comment
Question by:Simon336697
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 9

Accepted Solution

by:
Christopher Jay Wolff earned 167 total points
ID: 39974001
I know some docs aren't reflecting what I have to do to get it to accept my syntax, although not very often.  Sometimes they say something like I have to use quotes, and it won't work until I take them out, or something similar.  The syntax does not call for listing DomainName parameter first above NoGlobalCatalog, but I would try it.

I'm going to back out after this as I'm new with Powershell, and I cannot test this on my 8.1 RT. I'm not sure you're supposed to have the quotes on the string.  Cannot test with my RT.  Here is syntax statement
http://technet.microsoft.com/en-us/library/hh974723.aspx

and here is another example
http://support.microsoft.com/kb/2737535

That's already more than I know.  Good luck.  I'll be watching to see how your answer turns out.
0
 
LVL 70

Assisted Solution

by:Qlemo
Qlemo earned 167 total points
ID: 39974332
That might be a bug with the cmdlet. Try to put the domain name parameter first to see if it makes a difference. (Positions should not matter if you use parameter names, but sometimes the parser is confused by alternative parameter sets, and chooses a wrong one).
0
 
LVL 17

Assisted Solution

by:Premkumar Yogeswaran
Premkumar Yogeswaran earned 166 total points
ID: 39974707
Hi,
Your command is almost correct, i am not sure on chaging the switch sequence will it trigger an error... try to mention the -domainname switch before dnsdelegation.. kindly refer below link for the same.

Kindly check the below Blog for more info
http://www.mustbegeek.com/install-domain-controller-in-server-2012-using-windows-powershell/

Regards,
Prem
0
 
LVL 1

Author Comment

by:Simon336697
ID: 39977106
Thanks guys really appreciate it.
0
 
LVL 1

Author Closing Comment

by:Simon336697
ID: 39981858
Thanks everyone.
0

Featured Post

Comparison of Amazon Drive, Google Drive, OneDrive

What is Best for Backup: Amazon Drive, Google Drive or MS OneDrive? In this free whitepaper we look at their performance, pricing, and platform availability to help you decide which cloud drive is right for your situation. Download and read the results of our testing for free!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A company’s centralized system that manages user data, security, and distributed resources is often a focus of criminal attention. Active Directory (AD) is no exception. In truth, it’s even more likely to be targeted due to the number of companies …
The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question