# Invoke-sqlcmd - not working in powershell code

**URL:** <https://forum.uipath.com/t/invoke-sqlcmd-not-working-in-powershell-code/476993>\
**Category:** Studio\
**Tags:** install, question, studio, system, database, activities\
**Created:** [September 29, 2022, 10:32am UTC](https://forum.uipath.com/t/invoke-sqlcmd-not-working-in-powershell-code/476993 "2022-09-29T10:32:08Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![veeramani.shanmugam](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/veeramani.shanmugam/32/176671_2.png) [@veeramani.shanmugam](https://forum.uipath.com/u/veeramani.shanmugam)\
**Post date:** [September 29, 2022, 10:32am UTC](https://forum.uipath.com/t/invoke-sqlcmd-not-working-in-powershell-code/476993/1 "2022-09-29T10:32:08Z")

</div>

TerminatingError(Invoke-Sqlcmd): “Could not load file or assembly ‘Microsoft.SqlServer.BatchParser, Version=15.100.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91’ or one of its dependencies. The system cannot find the file specified.”

Getting above mentioned error while calling the powershell script using invoke powershell activity.

Same code is working fine in powershell ISE or cmd line..

Assuming → Bot will create new powershell session and execute the script as similiar to executing them in ISE editor. API and then DB call, and vice versa so many steps are involved..

so i have no choice to go with UiPath sql activies.

Any better suggestions to overcome this ?

---

<div class="post-metadata">

**Author:** ![marian.platonov](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/marian.platonov/32/260263_2.png) [@marian.platonov](https://forum.uipath.com/u/marian.platonov)\
**Post date:** [September 29, 2022, 10:55am UTC](https://forum.uipath.com/t/invoke-sqlcmd-not-working-in-powershell-code/476993/2 "2022-09-29T10:55:24Z")

</div>

Try the behavior in a Windows-Legacy project and in a Windows/Cross-Platform project.  
They are using different PowerShell versions.

---

<div class="post-metadata">

**Author:** ![veeramani.shanmugam](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/veeramani.shanmugam/32/176671_2.png) [@veeramani.shanmugam](https://forum.uipath.com/u/veeramani.shanmugam)\
**Post date:** [September 29, 2022, 12:06pm UTC](https://forum.uipath.com/t/invoke-sqlcmd-not-working-in-powershell-code/476993/3 "2022-09-29T12:06:02Z")

</div>

Invoke-Sqlcmd - uses 64 bit… so added using sql connections to resolve it…  
Uipath user 32 bit, so changed the script using sql connection string and other way around.  
Thanks Marian Platonov

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/system/32/182466_2.png) [@system](https://forum.uipath.com/u/system)\
**Post date:** [October 2, 2022, 12:06pm UTC](https://forum.uipath.com/t/invoke-sqlcmd-not-working-in-powershell-code/476993/4 "2022-10-02T12:06:29Z")

</div>

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.
