# ScriptBlock doesn't work with variables

**URL:** <https://forums.powershell.org/t/scriptblock-doesnt-work-with-variables/16638>\
**Category:** PowerShell Help\
**Created:** [May 24, 2021, 5:41pm UTC](https://forums.powershell.org/t/scriptblock-doesnt-work-with-variables/16638 "2021-05-24T17:41:14Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![kvprasoon](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/kvprasoon/32/4449_2.png) [@kvprasoon](https://forums.powershell.org/u/kvprasoon)\
**Post date:** [May 25, 2021, 4:12am UTC](https://forums.powershell.org/t/scriptblock-doesnt-work-with-variables/16638/3 "2021-05-25T04:12:36Z")

</div>

@thelmomauleon Welcome to [PowerShell.org](http://PowerShell.org) forums.

@tonyd has provided the right documentation to understand how the variable thing works in a remote execution, in addition [Get-SmbShareAccess Cannot validate argument on parameter ‘Name’ - PowerShell Help - PowerShell Forums](https://forums.powershell.org/t/get-smbshareaccess-cannot-validate-argument-on-parameter-name/16559)

Will also help you as it has is a similar thread.

---

_[View the full topic](https://forums.powershell.org/t/scriptblock-doesnt-work-with-variables/16638)._
