Home Forums Programming Powershell Errors while trying to copy files to UNC path using Powershell RE: Errors while trying to copy files to UNC path using Powershell

  • Hi webrunner - did you get this working?

    I'm trying to do this exact same thing with the same starting script, running on SQL Agent on a SQL 2012 box.

    I've already removed "cls" to get around the "cannot set screen color" errors. I've added "cd c:" at the top of the script to get out of "sqlserver:\" provider. But after all that I started getting "c:\ cannot be coped to c:\" errors, so I abandoned use of the "Powershell" step as being too wonky, and am instead trying to just call powershell.exe directly with a CmdExec.

    I try the following:

    c:\windows\system32\WindowsPowerShell\v1.0\powershell.exe -file "?c:\Scripts\CopySQLBackups.ps1"

    However I'm getting these errors:

    Processing -File '?c:\Scripts\CopySQLBackups.ps1' failed: The given path's format is not supported. Specify a valid path for the -File parameter.

    Notice the "?" mark in the file name on the error, not sure where that's coming from.

    Thanks for any help from any quarters!