Permission errors in PowerShell

前端 未结 4 571
臣服心动
臣服心动 2020-12-16 09:24

I am new to PowerShell. When trying to write a simple script that deletes the contents of a folder and then fills it with files copied from a different folder, I always get

4条回答
  •  悲&欢浪女
    2020-12-16 09:46

    After this error (and assuming at that point in it the most recent error):

    $error[0] | fl * -force
    

    will expand the details of the error and exception. That should give you more information.

    Another thing to do is to switch on verbose logging

    $VerbosePreference = "Continue"
    

    to get more details about specifically what operation is being performed when the error occurs.

    Finally PowerShell ISE includes a debugger which allows you to step through your script.

提交回复
热议问题