How can i deploy Cmd script with elevated privilege?

i use this  manualy, open cmd as administrator and its working perfectly but i would like to able to deply it. Here the script i use.

how can i execute this and create my package?


net use s: "\\server\app$\Dynamics NAV\Modifications\Mod-1\X86"

rd "C:\Program Files\Microsoft Dynamics NAV\60\Classic\Add-ins" /s /q

md "C:\Program Files\Microsoft Dynamics NAV\60\Classic\Add-ins"


Robocopy  S: "C:\Program Files\Microsoft Dynamics NAV\60\Classic\Add-ins" *.* /e

pushd "C:\Program Files\Microsoft Dynamics NAV\60\Classic\Add-ins\AttachementCenter"

call AttachmentCenter.bat


pushd "C:\Program Files\Microsoft Dynamics NAV\60\Classic\Add-ins\Mail"

call Mail.bat

popd pushd "C:\Program Files\Microsoft Dynamics NAV\60\Classic\Add-ins\NavDropZone"

call DropZone.bat


pushd "C:\Program Files\Microsoft Dynamics NAV\60\Classic\Add-ins\feature"

call feature.bat


net use s: /del



Date Votes
  • When you deploy a package it is automatically run in an elevated mode. (assuming the credentials you are using to deploy have Administrator rights).

    Have you tried taking that batch file and using it as the Install File in a package? The only thing you need to watch for is if there is any interaction that is needed after the script starts. If there are any pauses or prompts (excluding the initial UAC prompt) in the scripts (since this script appears to call additional bat files) then you'd find that the deployment would hang.


Please sign in to leave a comment.

Didn't find what you were looking for?

New post