I have this block in my deployment script which I am running on the build machine. It should move files on staging machine from Installs folder to application folder.
Before this block, there are several more actions successfuly executed with Invoke-Session
write-host "Deploying" -foregroundcolor red -backgroundcolor yellow invoke-command -session $s { Get-ChildItem -Path "C:\Install\pre_master" | Copy-Item -Destination "C:\inetpub\wwwroot\pre_master" -force -Recurse } If I create a session manually in PS and paste this block, it works ok.
If I run the script, this step spams me with millions (for every file Im trying to move I suppose?)
The input object cannot be bound to any parameters for the command either because the command does not take pipeline in put or the input and its properties do not match any of the parameters that take pipeline input. + CategoryInfo : InvalidArgument: (0201-KS.xml:PSObject) [Copy-Item], ParameterBindingException + FullyQualifiedErrorId : InputObjectNotBound,Microsoft.PowerShell.Commands.CopyItemCommand
So my question is : Why this same block of code works in PS when executed manually. but doesnt work in script?
Both machines have powershell 2.0