Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6583959
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T16:28:37+00:00 2026-05-25T16:28:37+00:00

I’m a little embarrassed to ask this. It seems like such a simple thing.

  • 0

I’m a little embarrassed to ask this. It seems like such a simple thing. And from all the examples I’ve found and tried, this should be working, but apparently I’m missing something.

I have a very simple powershell script:

[IO.Directory]::SetCurrentDirectory("C:\Program Files (x86)\MyFolder")
cp .\simpleTestScript.ps1 .\sucess.ps1

I’ve run, as admin: Set-ExecutionPolicy remoteSigned -scope localMachine. And I’m scheduling the script as administrator, so there shouldn’t be permission issues. I discovered that “cd” didn’t quite work as expected in powershell, but SetCurrentDirectory is a good stand in. But maybe it’s still a working directory issue. I can run it from a batch file with this line:

powershell.exe -File "C:\Program Files (x86)\MyFolder\simpleTestScript.ps1"

And it runs to completion, copies the file, and life is good.

But

Scheduling that same command (in Win7’s task scheduler) “completes successfully”, but no file is copied.
No change when I put C:\Program Files (x86)\MyFolder\ in the “start in:” field.

So what am I missing here?

Edit, some other things I’ve tried

$scriptDir =  Split-Path $myInvocation.MyCommand.Path
cp $scriptDir\simpleTestScript.ps1 $scriptDir\sucess.ps1

Same behavior

$scriptDir = "C:\Program Files (x86)\MyFolder"
cp $scriptDir\simpleTestScript.ps1 $scriptDir\sucess.ps1

Same behavior

[IO.Directory]::SetCurrentDirectory((Convert-Path (Get-Location -PSProvider FileSystem)))
cp .\simpleTestScript.ps1 .\sucess.ps1

Same behavior. Running as a batch file, it works. But scheduled, it doesn’t copy the file.

I’ve also tried scheduling the batch file which calls the powershell script, which is just plain silly and also doesn’t work.

Edit, part Duex
Oh yeah, this would probably help. This is on windows server 2008 R2. Powershell 2.0

Edit
hmmmmm, the advice out there, including manojlds, works fine when when applying it in windowsXP. So this is a Server 2008 issue.

Edit Finale
So it turns out that it’s a security issue. I’m running as admin to do this, but no, apparently when they changed the scheduler in Vista, they decided to add a “did you really mean to do this?” checkbox. So I’m sorry, StackOverflow and especially to you Manojlds, this turned out to be more of a super-user problem. But damn you Microsoft for adding a new feature that changed the behavior of an old tool. You could have had that checked by default and life would have been good.
AllofMyRage
All of my rage.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T16:28:38+00:00Added an answer on May 25, 2026 at 4:28 pm

    Filling out an answer just so there isn’t an unanswered question out there.

    So it turns out that it’s a security issue. I’m running as admin to do this, but no, apparently when they changed the scheduler in Vista, they decided to add a “did you really mean to do this?” checkbox. So I’m sorry, StackOverflow and especially to you Manojlds, this turned out to be more of a super-user problem. But damn you Microsoft for adding a new feature that changed the behavior of an old tool. You could have had that checked by default and life would have been good.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For some reason, after submitting a string like this Jack’s Spindle from a text
I have just tried to save a simple *.rtf file with some websites and
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have a text area in my form which accepts all possible characters from
Does anyone know how can I replace this 2 symbol below from the string
I have some data like this: 1 2 3 4 5 9 2 6
link Im having trouble converting the html entites into html characters, (&# 8217;) i
this is what i have right now Drawing an RSS feed into the php,
I've got a string that has curly quotes in it. I'd like to replace
Seemingly simple, but I cannot find anything relevant on the web. What is the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.