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 MotionBlackBerry Enterprise Server Resource KitBlackBerry Enterprise Server User Administration Tool Client"
./BESUserAdminClient -username $args[0] -password $args[1] -ad_auth -domain staging -b bbbes -u $args[2] -change -wrandom
} -argumentlist $username $password $u
Or define the parameters inside the script block and use named parameters:
Invoke-Command -Session $s -Scriptblock {
param(
$username,$password,$u
)
cd "C:Program Files (x86)Research In MotionBlackBerry Enterprise Server Resource KitBlackBerry Enterprise Server User Administration Tool Client"
./BESUserAdminClient -username $username -password $password -ad_auth -domain staging -b bbbes -u $u -change -wrandom
} -argumentlist $username $password $u
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…