Hi there
I'm just testing a section of my script whereby i want to eliminate hard coding a version folder and pass something like this
Login credentials are passed in the script from another XML so that logging into the server is not an issue.
$deployversion = "v4"
Write-Host "copied Register.bat to \\$server\e$\$deployversion\Assets\bin\"
$reg = invoke-command -computername ServerA -ScriptBlock {Set-Location "E:\$deployversion\Assets\bin"; & ".\Register.bat"} -erroraction 'stop' -credential $cred
When i run this script on it's own in PowerGUI script editor, i get message saying unable to find E:\$deployversion\Assets\bin folder on the server. So looks like $deployversion is not getting passed to the invoke command.
please can you advise how to resolve this issue?