With a PowerShell script I try to create a new file as follows:
New-Item -Path $LogDir -Value $LogName -Force -ItemType File
which is refused with the following error messsage:
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
I am executing the script in an Administrator PowerShell 2.0 window on Windows Server 2008. The directory exists, but how can I fix this error?