web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Check if Project exists from PowerShell

(0) ShareShare
ReportReport
Posted on by 4,079

As a part of my deployment Power-Shell script, I need to check if an Development Project exists in AX.

Does anyone know how to do that?

*This post is locked for comments

I have the same question (0)
  • Sohaib Cheema Profile Picture
    49,679 Super User 2026 Season 1 on at

    A way i can imagine is to call .net code from PowerShell and .Net code should be responsible to read AX using AIF web services.

  • Suggested answer
    Martin Dráb Profile Picture
    239,364 Most Valuable Professional on at

    You can also use Business Connector from Powershell. This is a solution if you can't make custom web services.

    Of course, Business Connector doesn't exist in newer versions of AX, but no solution will be upgradable and therefore it doesn't matter.

  • Verified answer
    Community Member Profile Picture
    on at

    If you have database access to the model database you could also use an SQL script such as:

    SELECT ISNULL((select top 1 1  

     FROM [YOUR_MODEL_DATABASE].[dbo].[ModelElement]

     where ElementType = 37 AND Name = 'YOUR_PROJECT_NAME'),0)

    To use this from powershell you can use the Invoke-SqlCmd scriptlet

  • Suggested answer
    Daniel Weichsel Profile Picture
    on at

    Assuming you have the AX2012 model management cmdlets at your disposal:

    @('USR Model', 'VAR Model') | % { Get-AxModel -Model $_ -Details | Select -ExpandProperty Elements } | ? { $_.ElementType -eq 'SharedProject' -and $_.Name -eq 'MyProjectName' }

    This starts with a list of models you want to search within, gets the model content for each, then filters that down to only shared projects with a matching name.  Adjust as needed.

  • Sohaib Cheema Profile Picture
    49,679 Super User 2026 Season 1 on at

    @Daniel Weichsel,

    This is great command. I wonder how this will behave with search of private project. I assume we need to pass Creator_PrivateProjectName instead of just PrivateProjectName, whereas for SharedProjects this works great.

    We cannot trust Like operator in that case for powershell by saying

    -and $._Name -Like '*NameOfMyPrivateProject'

  • Daniel Weichsel Profile Picture
    on at

    @Sohaib Cheema, you've got it.  AxUserId_PrivateProjectName.  If you need to avoid wildcards, you'll have to know the AX user ID ahead of time, or you might use the Get-AxUser cmdlet to help get the AX user ID matching a Windows identity.  Get-AxUser does establish a Business Connector session behind the scenes though, so the target environment would have to be running.

  • Rudi Hansen Profile Picture
    4,079 on at

    [quote user="Daniel Weichsel"]

    @('USR Model', 'VAR Model') | % { Get-AxModel -Model $_ -Details | Select -ExpandProperty Elements } | ? { $_.ElementType -eq 'SharedProject' -and $_.Name -eq 'MyProjectName' }

    [/quote]

    This looks like it does what i need thanks for the tip.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
CP04-islander Profile Picture

CP04-islander 26

#2
Michel ROY Profile Picture

Michel ROY 14

#3
imran ul haq Profile Picture

imran ul haq 8

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans