locked
Copy command for Web App Pool is not working RRS feed

  • Question

  • Hi,

    I am trying to copy a web app pool with following commands:

    import-module webadministration
    Stop-WebAppPool -Name "OldAppPool"
    copy IIS:\AppPools\OldAppPool IIS:\AppPools\NewAppPool -force

    Command is working fine in Windows 7, IIS 7, Powershell 2 environment

    But it is not working in Windows Server 2012, IIS 8, PowerShell 3 environemnt

    Getting error: copy : Object reference not set to an instance of an object.

    Please suggest!


    If this answers your question please mark as answer. If this post is helpful, please vote as helpful by clicking the upward arrow mark next to my reply.



    Thursday, September 28, 2017 3:27 PM

All replies

  • Hi,

    Based on my research, I'd like to explain that copy IIS:\AppPools\OldAppPool IIS:\AppPools\NewAppPool -force might copy OldAppPool under NewAppPool, for example: IIS:\AppPools\NewAppPool\OldAppPool. You could have a try with the following scripts to copy WorkerProcesses from IIS:\AppPools\OldAppPool to IIS:\AppPools\NewAppPool. Hope it is helpful to you:
    copy IIS:\AppPools\OldAppPool\WorkerProcesses  IIS:\AppPools\NewAppPool -Force -Recurse

    For more information, please refer to the following article:
    Copy-Item
    https://docs.microsoft.com/en-us/powershell/module/Microsoft.PowerShell.Management/Copy-Item?view=powershell-5.1

    If you need further help, please feel free to let us know.

    Best Regards,
    Albert Ling

    Please remember to mark the replies as an answers if they help and unmark them if they provide no help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    Monday, October 2, 2017 6:49 AM
  • Hi,

    Just checking in to see if the information provided was helpful.

    Please let us know if you would like further assistance.

    Best Regards,
    Albert Ling

    Please remember to mark the replies as an answers if they help and unmark them if they provide no help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    Thursday, October 5, 2017 8:46 AM
  • Hi,

    I am checking how the issue is going, if you still have any questions, please feel free to contact us.

    If you resolved it using our solution, please "mark it as answer" to help other community members find the helpful reply quickly.
    If you resolve it using your own solution, please share your experience and solution here. It will be very beneficial for other community members who have similar questions.
    If no, please reply and tell us the current situation in order to provide further help.

    Appreciate for your feedback.

    Best Regards,
    Albert Ling

    Please remember to mark the replies as an answers if they help and unmark them if they provide no help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    Tuesday, October 10, 2017 9:18 AM