Register Scheduled job with access to remote server

Welcome Forums General PowerShell Q&A Register Scheduled job with access to remote server

This topic contains 2 replies, has 2 voices, and was last updated by

 
Participant
1 year ago.

  • Author
    Posts
  • #87503

    Participant
    Points: 2
    Rank: Member

    Hello,

    I have a script, where I copy a file to a remote server (virtual machine).

    $destination = '\\ServerName\C$\users\public\Documents'
    Copy-Item $file.FullName -Destination $destination -Force

    I can execute the script and get the expected result (copying the file) manually. When I register the script execution as a scheduled job however, it fails to copy the file. Am I missing credentials or something?
    Thanks

  • #87563

    Participant
    Points: 320
    Helping Hand
    Rank: Contributor

    What credentials are you specifying in the Scheduled Task?
    They must be creds that have admin creds for all hosts where the action is to happen.

    • #87740

      Participant
      Points: 2
      Rank: Member

      Will give it a try, thanks.

The topic ‘Register Scheduled job with access to remote server’ is closed to new replies.