0
隨着PowerShell腳本我嘗試創建一個新的文件,如下所示:如何授予訪問權限以創建新文件?
New-Item -Path $LogDir -Value $LogName -Force -ItemType File
這與以下錯誤消息話題拒絕:
New-Item : Access to the path 'D:\Testing\Data\Powershell\Log' is denied. At D:\Testing\Data\Powershell\LoadRunner\LRmain.ps1:27 char:9 + New-Item <<<< -Path $LogDir -Value $LogName -Force -ItemType File + CategoryInfo : PermissionDenied: (D:\Testing\Data\Powershell\Log:String) [New-Item], UnauthorizedAccessException + FullyQualifiedErrorId : NewItemUnauthorizedAccessError,Microsoft.PowerShell.Commands.NewItemCommand
我執行該腳本在管理員的PowerShell 2.0的窗口在Windows Server 2008上。該目錄存在,但我該如何解決此錯誤?
'-Value' - >'-Name' – PetSerAl
我想這就是它...謝謝 – Alex