简体   繁体   中英

Run a PowerShell script in Task Scheduler that is located on network location

I'm trying to administer PowerShell scripts on a central shared location. At the moment the .ps1 scripts are all stored on many different servers.

The scripts are used in Scheduled Tasks with the 'Action' specifics:

  • Program/script: powershell.exe
  • Add arguments (optional): G:..\\scriptABC.ps1
  • Start in (optional): C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\

Now the goal is to have them all on a shared location:

  • \\\\domain\\root..\\scripts\\scriptABC.ps1

Problem: When I update the 'Add arguments' field to "\\\\domain\\root..\\scripts\\scriptABC.ps1" and try to start the task, it'll say Running for a few seconds and than Ready again, but nothing happened. So it works like a charm when a local drive is specified, but not when a UNC path is specified.

Additional info:

  • Working on Windows Server 2012 R2

Any thoughts?

Check out the following link

https://community.spiceworks.com/how_to/17736-run-powershell-scripts-from-task-scheduler

Also the machine running the task will need to have permission to access the file on the network

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM