# Powershell Encoded Command (Base64) not working

**URL:** <https://forum.uipath.com/t/powershell-encoded-command-base64-not-working/263188>\
**Category:** Help\
**Tags:** powershell, question, system, activities\
**Created:** [October 19, 2020, 2:19pm UTC](https://forum.uipath.com/t/powershell-encoded-command-base64-not-working/263188 "2020-10-19T14:19:59Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![andrewjames](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/andrewjames/32/82599_2.png) [@andrewjames](https://forum.uipath.com/u/andrewjames)\
**Post date:** [October 19, 2020, 2:19pm UTC](https://forum.uipath.com/t/powershell-encoded-command-base64-not-working/263188/1 "2020-10-19T14:19:59Z")

</div>

I’m trying to use Invoke Power Shell activity to run a base64 encoded command. When I run in PowerShell it works, but the same command in UiPath appears to do nothing.

![image](https://global.discourse-cdn.com/uipath/original/3X/e/9/e937e46bcf2924509aea09c0df36f12816e4284e.png)  
(The “IsScript” property is ticked on this activity)

The command is to send an email using a variation of:  
“Send-MailMessage –From ‘Test User [noreply@organisation.org.uk](mailto:noreply@organisation.org.uk)’ –To 'user@example.com’ –Subject ‘subject’ -Body ‘body’ -SmtpServer smtp.mysmtpserver.org.uk -BodyAsHtml”

This is encoded from unicode to base64 using [https://www.base64encode.org/](https://www.base64encode.org/)

Can anyone advise how I can run a base64 encoded powershell through UiPath? Thanks

---

<div class="post-metadata">

**Author:** ![NIVED\_NAMBIAR](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/nived_nambiar/32/169066_2.png) [@NIVED\_NAMBIAR](https://forum.uipath.com/u/NIVED_NAMBIAR)\
**Post date:** [October 19, 2020, 2:21pm UTC](https://forum.uipath.com/t/powershell-encoded-command-base64-not-working/263188/2 "2020-10-19T14:21:12Z")

</div>

Hi @andrewjames, is there any error being thrown

---

<div class="post-metadata">

**Author:** ![andrewjames](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/andrewjames/32/82599_2.png) [@andrewjames](https://forum.uipath.com/u/andrewjames)\
**Post date:** [October 19, 2020, 2:25pm UTC](https://forum.uipath.com/t/powershell-encoded-command-base64-not-working/263188/3 "2020-10-19T14:25:18Z")

</div>

Not from UiPath… no.  
 ![image](https://global.discourse-cdn.com/uipath/original/3X/1/c/1c551c835eb7894ef4816af793d42613c83a1762.png)  
If I run the same command, not encoded, it works fine.

---

<div class="post-metadata">

**Author:** ![NIVED\_NAMBIAR](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/nived_nambiar/32/169066_2.png) [@NIVED\_NAMBIAR](https://forum.uipath.com/u/NIVED_NAMBIAR)\
**Post date:** [October 19, 2020, 2:28pm UTC](https://forum.uipath.com/t/powershell-encoded-command-base64-not-working/263188/4 "2020-10-19T14:28:00Z")

</div>

Hi @andrewjames, why there is a need of encoding there  
Just write the script directly and run it using the invoke powershell activity

Since it is an action of sending mail, kindly check whether mail is sent

---

<div class="post-metadata">

**Author:** ![andrewjames](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/andrewjames/32/82599_2.png) [@andrewjames](https://forum.uipath.com/u/andrewjames)\
**Post date:** [October 19, 2020, 2:29pm UTC](https://forum.uipath.com/t/powershell-encoded-command-base64-not-working/263188/5 "2020-10-19T14:29:20Z")

</div>

Encoding is needed due to complex quotations in the body of the email message. Powershell needs encoding to handle these.

However, I’ve found the solution… I’d missed a character off when cutting and pasting the base64 encoded text! Rookie error, but it does work now.

Thank you for your help
