I have a script that references another PS script that deletes a bunch of files in some folders. Both files are in the same folder. When I run my script, it works fine and the files are deleted from the folders as desired. However, if I try it from the Run command or from within task scheduler, it doesn't run. I triple checked and the execution policy is set to unrestricted.
I have been beating my head against the wall for hours, trying every possible combination and am at the end of my rope for today. I'm exceedingly new to Powershell and would deeply appreciate any help.
The error I get is:
The term '.\deleteold.ps1' is not recognized as the name of a cmdlet, function, script file, or operable program....
At C:\users\user_name\folderpurge.ps1:1 char: 16
+ .\deleteold.ps1 <<<< -folderpath c:\users\user_name\testfolder -fileage 1 -logfile c:\users\user_name\scanpurgelog.txt -NoFolder
+CategoryInfo :ObjectNotFound: (.\deleteold.ps1:String) [], CommandNotFoundException
+FullyQualifiedErrorID :CommandNotFoundException