Support Forums

Cannot run Dcpromo /unattend command in primal forms 2011

Archived support forum for customers who once purchased a PrimalForms product license. This forum is locked.
User avatar
CSC_WPS
Posts: 8
Joined: Thu Nov 17, 2011 2:53 am

Cannot run Dcpromo /unattend command in primal forms 2011

Postby CSC_WPS » Tue Aug 19, 2014 1:55 am

The code for demoting the Domain Controler is not working in primal form 2011. This is my code:

If ($radiobuttonLastDCYes.Checked -eq $false)
{
dcpromo /unattend /UserName:$textboxAdministrator.Text /UserDomain:$textboxDomName.Text /Password:$textboxAdminPwd.Text /AdministratorPassword:$textboxLocAdmPwd.Text /RemoveApplicationPartitions=yes /RebootOnCompletion=yes
}

and the error that i get is:

The term dcpromo is not recognized as the name of cmdlet, function, scriptfile or operable program. Check the spelling of the name or if the path was included, verify that the path is correct and try again. Cannot bind argument to parameter 'FilePath' because it is null.

I don't understand why is it not able to recognize 'dcpromo'.
I am able to run the same command manually in powershell on WIndows Server 2008 R2. Howeever when I run this through a primal form project, I am getting the error.

I have also tried Invoke-Command, start-process, calling another ps1\cmd file to run the dcpromo commmand, but it keeps giving same error saying dcpromo not recognized.

Need urgent help as I'm out of ideas.

Thanks,
Hari
User avatar
davidc
Posts: 4354
Joined: Thu Aug 18, 2011 4:56 am

Re: Cannot run Dcpromo /unattend command in primal forms 201

Postby davidc » Tue Aug 19, 2014 7:55 am

If this is a cmdlet from a module or snapin, be sure to explicitly load it within your script, because PrimalForms does not load profiles. PF 2011 only supports PowerShell V2, so if the module or snapin is requires V3 or greater, it will not work at all.

David
David
SAPIEN Technologies, Inc.
User avatar
CSC_WPS
Posts: 8
Joined: Thu Nov 17, 2011 2:53 am

Re: Cannot run Dcpromo /unattend command in primal forms 201

Postby CSC_WPS » Wed Aug 20, 2014 1:45 am

Its just a simple command which demotes the Domain Controller.
It runs with powershell V1 and V2 both.
Primal Forms just not able to recognize the command and says it Cannot recognize dcpromo.
User avatar
davidc
Posts: 4354
Joined: Thu Aug 18, 2011 4:56 am

Re: Cannot run Dcpromo /unattend command in primal forms 201

Postby davidc » Wed Aug 20, 2014 8:34 am

Ok I see, Dcpromo is an external executable and not a cmdlet or alias. Most likely the problem is that dcpromo is 64 bit and PrimalForms is a 32 bit application, therefore it doesn't find the executable when running the script.

David
David
SAPIEN Technologies, Inc.
User avatar
CSC_WPS
Posts: 8
Joined: Thu Nov 17, 2011 2:53 am

Re: Cannot run Dcpromo /unattend command in primal forms 201

Postby CSC_WPS » Thu Aug 21, 2014 12:49 am

Dcpromo is used to promote a server as a Domain Controller and the same command is used to demote the domain controller with different arguments.
The promotion of Domain Controller using primal Forms 2011 is working fine however the demotion is not working.

If Primal Forms cannot recognize 64 bit exe, I'm wondering how is it able to promote the server using same 'Dcpromo' command?

I'm using the exact same method to demote which is used for promotion.
User avatar
CSC_WPS
Posts: 8
Joined: Thu Nov 17, 2011 2:53 am

Re: Cannot run Dcpromo /unattend command in primal forms 201

Postby CSC_WPS » Thu Aug 21, 2014 12:56 am

This is the way I'm calling dcpromo:


$demotion = "/unattend /UserName:$($textboxAdministrator.text) /UserDomain:$($textboxDomName.text) /Password:$($textboxAdminPwd.text) /AdministratorPassword:$($textboxLocAdmPwd.text) /RebootOnCompletion:yes"

###########Demoting the DC

$demoteinfo = New-Object System.Diagnostics.ProcessStartInfo("dcpromo",$demotion)
$demotestatus = [diagnostics.process]::start($demoteinfo)
$demotestatus.WaitForExit()
User avatar
CSC_WPS
Posts: 8
Joined: Thu Nov 17, 2011 2:53 am

Re: Cannot run Dcpromo /unattend command in primal forms 201

Postby CSC_WPS » Thu Aug 21, 2014 12:57 am

I get the same error message even if I give the full path of 'Dcpromo'

This is the same method used to promote the Domain Controller.
User avatar
Alexander Riedel
Posts: 5777
Joined: Tue May 29, 2007 4:43 pm

Re: Cannot run Dcpromo /unattend command in primal forms 201

Postby Alexander Riedel » Thu Aug 21, 2014 1:06 am

Replace dcpromo with Notepad.exe
See if that starts.

If it does, then you have an access or rights problem.
If that gives you the same error then your code is different for demoting than from promoting.

If you substitute notepad.exe and still get the "The term dcpromo is not recognized as ..." error, then you are looking at the wrong code.

Since we don't see your script it's hard to judge, but usually that would call for using a debugger, set a breakpoint and examine the variables at the location and follow the program logic to see if you even hit the right spot.
Alexander Riedel
SAPIEN Technologies, Inc.
User avatar
davidc
Posts: 4354
Joined: Thu Aug 18, 2011 4:56 am

Re: Cannot run Dcpromo /unattend command in primal forms 201

Postby davidc » Thu Aug 21, 2014 8:26 am

If the Dcpromo.exe is located the C:\Windows\System32 folder, a 32 bit app will not find it on a 64 bit OS, since the System32 folder path is mapped to a different location for 32 bit apps.

You will have to use:

C:\Windows\Sysnative

instead of:

C:\Windows\System32


FYI, PrimalForms 2011 is at end of life, and we will no longer issue service builds.

David
David
SAPIEN Technologies, Inc.

Return to “PrimalForms”

Who is online

Users browsing this forum: No registered users and 1 guest