locked
Using powershell to create a windows service for a .cmd file(script) RRS feed

  • Question

  • Hello all,
    I am running:
    windows 2008 server

    I would like to know what i am doing wrong with trying to get this script file i created to be successfully be created as a service and sart successfully. If i use the new-service command. It creates the windows service but it will not start. I have used regular cmd prompt but i just started using this powershell.

    here is what i typed in powershell and output i recieved:

    Windows PowerShell
    Copyright (C) 2009 Microsoft Corporation. All rights reserved.

    PS C:\Windows\system32> cd\
    PS C:\> new-service -name WlsAdmin -binaryPathName "C:\Oracle\Middleware\user_projects\domains\FRClassicDomain\bin\start
    ManagedWebLogic.cmd -k beasvc"

    Status   Name               DisplayName
    ------   ----               -----------
    Stopped  WlsAdmin           WlsAdmin

    PS C:\> start-service -name WlsAdmin
    Start-Service : Service 'WlsAdmin (WlsAdmin)' cannot be started due to the following error: Cannot start service WlsAdm
    in on computer '.'.
    At line:1 char:14
    + start-service <<<<  -name WlsAdmin
        + CategoryInfo          : OpenError: (System.ServiceProcess.ServiceController:ServiceController) [Start-Service],
       ServiceCommandException
        + FullyQualifiedErrorId : CouldNotStartService,Microsoft.PowerShell.Commands.StartServiceCommand

    the script code i created:

    SETLOCAL

    set DOMAIN_NAME=FRClassicDomain

    set USERDOMAIN_HOME=C:\Oracle\Middleware\user_projects\domains\FRClassicDomain

    set SERVER_NAME=AdminServer

    set WL_HOME=C:\Oracle\Middleware\wlserver_10.3

    set WLS_USER=username

    set WLS_PASSWORD= password

    set ADMIN_URL=t3://nyct2bwyugosdv1:7001

    set JAVA_VENDOR=Sun

    set JAVA_HOME=C:\Program Files\Java\jdk1.7.0

    set PRODUCTION_MODE=true

    set MEM_ARGS=-Xms512m –Xmx512m

    call "C:\Oracle\Middleware\wlserver_10.3\server\bin\installSvc.cmd"

    ENDLOCAL

     ***If this is not the right place to ask this type of question can you direct me where would be the right place***

    ***i already posted to other forums regarding this. all feeedback i tried failed, which included using the cmd prmpt and node manager that is used with oracle software***

    Wednesday, May 15, 2013 7:42 PM

Answers

All replies