Powershell/GIT – Create PackageLocalDirectory Symlinks

Its been a while since my last post, but to follow are hopefully a couple of my mental notes I need to put down into writing for future use.

Recently i had to connect a development environment to a GIT repository. I followed the following guide:


However due to a large number of different models in the repo, it wouldve taken quite a while to create each and every folder link, so i wrote the following (draft) script. To run it, navigate to the C:\AOSService\PackagesLocalDirectory in Powershell and run the following:

Get-ChildItem –Path "C:\users\Administrator\source\repos\[FOLDER WITH MODEL FOLDERS]\"  -Directory |
Foreach-Object {    
    New-Item -ItemType SymbolicLink -Path $_.BaseName -Target $_.FullName

    Write-Host $_.BaseName


Note 1: This script is not bulletproof and I’m do not claim in anyway to be a Powershell expert, so if you have improvements let me know, I’d love to learn.

Note 2: I in addition to the post above, I needed to fix securities on the folders in my repo to allow the AOS service to read the models as i was receiving these errors:

AX is shutting down due to an error.
An error occurred when starting the AOS.
Exception details:
Microsoft.Dynamics.AX.InitializationException: An error occurred when starting the AOS. ---> System.UnauthorizedAccessException: Access to the path 'C:\AOSService\PackagesLocalDirectory\[MODEL FOLDER]' is denied.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileSystemEnumerableIterator`1.CommonInit()
   at System.IO.FileSystemEnumerableIterator`1..ctor(String path, String originalUserPath, String searchPattern, SearchOption searchOption, SearchResultHandler`1 resultHandler, Boolean checkHost)