So trying to get my script working remotely but I cannot get any output and the script doesn't seem to even start to run. I have tested that winrm works from application polling engine server towards remote server with "winrm get winrm/Config -r:hostname". Execution mode is remote and I tried with http and https without success. Script works fine if I run it locally. If I have understood correctly changing execution mode to remote just runs this same script on the target server.
This is my script which I'm trying to get working:
# Arguments example: hostname1 hostname2 #Variables $transfer_host = $args.get(0); $ownname = $args.get(1); $lockfile = "C:\temp\$ownname.$transfer_host.$(get-date -format ss-mm-dd-MM-yyyy).lock" $transferedfile = "$ownname.$transfer_host.$(get-date -format ss-mm-dd-MM-yyyy).dat" # Script starts $Error.Clear(); # Try copy echo $null >> $lockfile $output=Measure-Command {Copy-Item C:\temp\output.dat \\$transfer_host\c$\temp\$transferedfile} | Select TotalSeconds #Clean up rm $lockfile rm \\$transfer_host\c$\temp\$transferedfile #Write output Write-Host "Statistic:" $output.TotalSeconds Write-Host "Message: Copy-item duration [sec]" exit 0;
Any idea where to start troubleshooting?