Passing PowerShell variables into a script block

You can pass values via the -arguments parameter and refer to them as $args[0] and so on inside the script block: Invoke-Command -Session $s -Scriptblock { cd “C:\Program Files (x86)\Research In Motion\BlackBerry Enterprise Server Resource Kit\BlackBerry Enterprise Server User Administration Tool Client” ./BESUserAdminClient -username $args[0] -password $args[1] -ad_auth -domain staging -b bbbes -u $args[2] -change … Read more