copy-item With Alternate Credentials

后端 未结 12 2072
长情又很酷
长情又很酷 2020-12-01 05:29

I\'m using the CTP of powershell v2. I have a script written that needs to go out to various network shares in our dmz and copy some files. However, the issue I have is that

12条回答
  •  醉酒成梦
    2020-12-01 05:42

    Bringing this back from the dead again. I got around a similar credentials problem by wrapping the .ps1 in a batch file and doing the Win7, Shift + r.Click RunAs. If you wanted to, you can also use PsExec thus:

    psexec.exe /accepteula /h /u user /p pwd cmd /c "echo. | powershell.exe -File script.ps1"
    

提交回复
热议问题