I've tried a bunch of things, but haven't had any luck yet. Could you please suggest a way to resolve this issue. Thanks very much to AdamL and dread1 for their help.
I used both suggestions. For reference, this is what the working code now looks like. Ampersand or spaces in path are not the problem. You're trying to use Invoke-Expression supplying path as parameter, which is not a valid command. Just change double quotation marks to single just in case. Also I suggest you create path using Join-Path instead of contatenating the strings.
Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Collectives on Stack Overflow. Learn more. United States English. Ask a question. Quick access. Search related threads. Remove From My Forums. Answered by:. Archived Forums. The Official Scripting Guys Forum! If your answer is "yes," you know what to do.
Dive in and help somebody! If your answer is "no," welcome to our fun little world! We'd recommend that you first head over to the Script Center, get your feet wet, and then come back to either ask or answer questions.
Who maps the network drive? And are you using the mapped name, instead of the underlying UNC native path? Because it sounds like the mapped drive is setup in your login script, which doesn't run if you're not logged in.
So, in a scheduled task, you do have the correct credentials for the UNC path, but no mapped drive letter. Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Collectives on Stack Overflow. Learn more. Asked 9 years, 9 months ago. Active 5 years, 10 months ago. Viewed 67k times. Is there a way I can achieve this? Imran Imran 1 1 gold badge 7 7 silver badges 13 13 bronze badges.
Upvoted the one that helped me below, but this answer also helped me debug it in my case stackoverflow. Add a comment. Active Oldest Votes. Nolonar 5, 3 3 gold badges 33 33 silver badges 54 54 bronze badges.
Here is my batch file Gene Mat Gene Mat 66 3 3 bronze badges. Benedict Benedict 2 2 silver badges 7 7 bronze badges. MSalters MSalters k 8 8 gold badges silver badges bronze badges.
0コメント