Wednesday, April 2, 2014

Troubleshooting Tip Powershell how to delete CUS Model with a space in the name

Hi All,

Greetings!

Thought to share an useful time saving tip while writing Powershell scripts. I wanted to uninstall the default CUS Model in AX 2012 from one of my local development environments. And because of the space in the model name between the words CUS and Model I got this error

For sometime, I struggled with the below error as shown below.














Solution:

However the solution was to use the escape character (grave-accent) ` which is on the left hand side of your keyboard between CUS and Model as shown above.

i.e.

Uninstall-AXModel -Model CUS` Model


7 comments:

  1. I thought you could use quotes around it. Now i always use the model ID :)

    ReplyDelete
  2. I thought you could use Quotes (i think ive done it before). Now i always use model id instead

    ReplyDelete
  3. Hello,
    an another solution is to embrace Model name by "

    Uninstall-AXModel -Model "CUS Model"



    ReplyDelete
  4. Well Guys. Thanks for your comments. i didn't get it to work using quotes. Hence had to use the escape character. Yes I agree with Model ID. However in this scenario the model id and name is the same.

    ReplyDelete
  5. You could also lookup the model Id and just use the model number, which is sometimes handy as well

    ReplyDelete
  6. Update - I recently had to uninstall the cus model once again in R3 CU8 Environment and using double quotes work e.g.

    Uninstall-AXmodel -Model "CUS Model" -Server "MyServerName" -Database "Mydbname_model" -Details


    Make sure if you have multiple instances of AOS, to specify the database name so that it deletes the model from right instance

    ReplyDelete